
(function(window,undefined){var jQuery=function(selector,context){return new jQuery.fn.init(selector,context);},_jQuery=window.jQuery,_$=window.$,document=window.document,rootjQuery,quickExpr=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/,rnotwhite=/\S/,rtrim=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,userAgent=navigator.userAgent,browserMatch,readyBound=false,readyList=[],DOMContentLoaded,toString=Object.prototype.toString,hasOwnProperty=Object.prototype.hasOwnProperty,push=Array.prototype.push,slice=Array.prototype.slice,indexOf=Array.prototype.indexOf;jQuery.fn=jQuery.prototype={init:function(selector,context){var match,elem,ret,doc;if(!selector){return this;}
if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;}
if(selector==="body"&&!context){this.context=document;this[0]=document.body;this.selector="body";this.length=1;return this;}
if(typeof selector==="string"){match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1]){doc=(context?context.ownerDocument||context:document);ret=rsingleTag.exec(selector);if(ret){if(jQuery.isPlainObject(context)){selector=[document.createElement(ret[1])];jQuery.fn.attr.call(selector,context,true);}else{selector=[doc.createElement(ret[1])];}}else{ret=buildFragment([match[1]],[doc]);selector=(ret.cacheable?ret.fragment.cloneNode(true):ret.fragment).childNodes;}
return jQuery.merge(this,selector);}else{elem=document.getElementById(match[2]);if(elem){if(elem.id!==match[2]){return rootjQuery.find(selector);}
this.length=1;this[0]=elem;}
this.context=document;this.selector=selector;return this;}}else if(!context&&/^\w+$/.test(selector)){this.selector=selector;this.context=document;selector=document.getElementsByTagName(selector);return jQuery.merge(this,selector);}else if(!context||context.jquery){return(context||rootjQuery).find(selector);}else{return jQuery(context).find(selector);}}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector);}
if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}
return jQuery.makeArray(selector,this);},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length;},toArray:function(){return slice.call(this,0);},get:function(num){return num==null?this.toArray():(num<0?this.slice(num)[0]:this[num]);},pushStack:function(elems,name,selector){var ret=jQuery();if(jQuery.isArray(elems)){push.apply(ret,elems);}else{jQuery.merge(ret,elems);}
ret.prevObject=this;ret.context=this.context;if(name==="find"){ret.selector=this.selector+(this.selector?" ":"")+selector;}else if(name){ret.selector=this.selector+"."+name+"("+selector+")";}
return ret;},each:function(callback,args){return jQuery.each(this,callback,args);},ready:function(fn){jQuery.bindReady();if(jQuery.isReady){fn.call(document,jQuery);}else if(readyList){readyList.push(fn);}
return this;},eq:function(i){return i===-1?this.slice(i):this.slice(i,+i+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(slice.apply(this,arguments),"slice",slice.call(arguments).join(","));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},end:function(){return this.prevObject||jQuery(null);},push:push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options,name,src,copy;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2;}
if(typeof target!=="object"&&!jQuery.isFunction(target)){target={};}
if(length===i){target=this;--i;}
for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue;}
if(deep&&copy&&(jQuery.isPlainObject(copy)||jQuery.isArray(copy))){var clone=src&&(jQuery.isPlainObject(src)||jQuery.isArray(src))?src:jQuery.isArray(copy)?[]:{};target[name]=jQuery.extend(deep,clone,copy);}else if(copy!==undefined){target[name]=copy;}}}}
return target;};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep){window.jQuery=_jQuery;}
return jQuery;},isReady:false,ready:function(){if(!jQuery.isReady){if(!document.body){return setTimeout(jQuery.ready,13);}
jQuery.isReady=true;if(readyList){var fn,i=0;while((fn=readyList[i++])){fn.call(document,jQuery);}
readyList=null;}
if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");}}},bindReady:function(){if(readyBound){return;}
readyBound=true;if(document.readyState==="complete"){return jQuery.ready();}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",DOMContentLoaded,false);window.addEventListener("load",jQuery.ready,false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",DOMContentLoaded);window.attachEvent("onload",jQuery.ready);var toplevel=false;try{toplevel=window.frameElement==null;}catch(e){}
if(document.documentElement.doScroll&&toplevel){doScrollCheck();}}},isFunction:function(obj){return toString.call(obj)==="[object Function]";},isArray:function(obj){return toString.call(obj)==="[object Array]";},isPlainObject:function(obj){if(!obj||toString.call(obj)!=="[object Object]"||obj.nodeType||obj.setInterval){return false;}
if(obj.constructor&&!hasOwnProperty.call(obj,"constructor")&&!hasOwnProperty.call(obj.constructor.prototype,"isPrototypeOf")){return false;}
var key;for(key in obj){}
return key===undefined||hasOwnProperty.call(obj,key);},isEmptyObject:function(obj){for(var name in obj){return false;}
return true;},error:function(msg){throw msg;},parseJSON:function(data){if(typeof data!=="string"||!data){return null;}
data=jQuery.trim(data);if(/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return window.JSON&&window.JSON.parse?window.JSON.parse(data):(new Function("return "+data))();}else{jQuery.error("Invalid JSON: "+data);}},noop:function(){},globalEval:function(data){if(data&&rnotwhite.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval){script.appendChild(document.createTextNode(data));}else{script.text=data;}
head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()===name.toUpperCase();},each:function(object,callback,args){var name,i=0,length=object.length,isObj=length===undefined||jQuery.isFunction(object);if(args){if(isObj){for(name in object){if(callback.apply(object[name],args)===false){break;}}}else{for(;i<length;){if(callback.apply(object[i++],args)===false){break;}}}}else{if(isObj){for(name in object){if(callback.call(object[name],name,object[name])===false){break;}}}else{for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}}
return object;},trim:function(text){return(text||"").replace(rtrim,"");},makeArray:function(array,results){var ret=results||[];if(array!=null){if(array.length==null||typeof array==="string"||jQuery.isFunction(array)||(typeof array!=="function"&&array.setInterval)){push.call(ret,array);}else{jQuery.merge(ret,array);}}
return ret;},inArray:function(elem,array){if(array.indexOf){return array.indexOf(elem);}
for(var i=0,length=array.length;i<length;i++){if(array[i]===elem){return i;}}
return-1;},merge:function(first,second){var i=first.length,j=0;if(typeof second.length==="number"){for(var l=second.length;j<l;j++){first[i++]=second[j];}}else{while(second[j]!==undefined){first[i++]=second[j++];}}
first.length=i;return first;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++){if(!inv!==!callback(elems[i],i)){ret.push(elems[i]);}}
return ret;},map:function(elems,callback,arg){var ret=[],value;for(var i=0,length=elems.length;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret[ret.length]=value;}}
return ret.concat.apply([],ret);},guid:1,proxy:function(fn,proxy,thisObject){if(arguments.length===2){if(typeof proxy==="string"){thisObject=fn;fn=thisObject[proxy];proxy=undefined;}else if(proxy&&!jQuery.isFunction(proxy)){thisObject=proxy;proxy=undefined;}}
if(!proxy&&fn){proxy=function(){return fn.apply(thisObject||this,arguments);};}
if(fn){proxy.guid=fn.guid=fn.guid||proxy.guid||jQuery.guid++;}
return proxy;},uaMatch:function(ua){ua=ua.toLowerCase();var match=/(webkit)[ \/]([\w.]+)/.exec(ua)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||!/compatible/.test(ua)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(ua)||[];return{browser:match[1]||"",version:match[2]||"0"};},browser:{}});browserMatch=jQuery.uaMatch(userAgent);if(browserMatch.browser){jQuery.browser[browserMatch.browser]=true;jQuery.browser.version=browserMatch.version;}
if(jQuery.browser.webkit){jQuery.browser.safari=true;}
if(indexOf){jQuery.inArray=function(elem,array){return indexOf.call(array,elem);};}
rootjQuery=jQuery(document);if(document.addEventListener){DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",DOMContentLoaded,false);jQuery.ready();};}else if(document.attachEvent){DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",DOMContentLoaded);jQuery.ready();}};}
function doScrollCheck(){if(jQuery.isReady){return;}
try{document.documentElement.doScroll("left");}catch(error){setTimeout(doScrollCheck,1);return;}
jQuery.ready();}
function evalScript(i,elem){if(elem.src){jQuery.ajax({url:elem.src,async:false,dataType:"script"});}else{jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}
function access(elems,key,value,exec,fn,pass){var length=elems.length;if(typeof key==="object"){for(var k in key){access(elems,k,key[k],exec,fn,value);}
return elems;}
if(value!==undefined){exec=!pass&&exec&&jQuery.isFunction(value);for(var i=0;i<length;i++){fn(elems[i],key,exec?value.call(elems[i],i,fn(elems[i],key)):value,pass);}
return elems;}
return length?fn(elems[0],key):undefined;}
function now(){return(new Date).getTime();}
(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+now();div.style.display="none";div.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return;}
jQuery.support={leadingWhitespace:div.firstChild.nodeType===3,tbody:!div.getElementsByTagName("tbody").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:/^0.55$/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:div.getElementsByTagName("input")[0].value==="on",optSelected:document.createElement("select").appendChild(document.createElement("option")).selected,parentNode:div.removeChild(div.appendChild(document.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"));}catch(e){}
root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id];}
try{delete script.test;}catch(e){jQuery.support.deleteExpando=false;}
root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function click(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",click);});div.cloneNode(true).fireEvent("onclick");}
div=document.createElement("div");div.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var fragment=document.createDocumentFragment();fragment.appendChild(div.firstChild);jQuery.support.checkClone=fragment.cloneNode(true).cloneNode(true).lastChild.checked;jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none';div=null;});var eventSupported=function(eventName){var el=document.createElement("div");eventName="on"+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,"return;");isSupported=typeof el[eventName]==="function";}
el=null;return isSupported;};jQuery.support.submitBubbles=eventSupported("submit");jQuery.support.changeBubbles=eventSupported("change");root=script=div=all=a=null;})();jQuery.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},expando:expando,noData:{"embed":true,"object":true,"applet":true},data:function(elem,name,data){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache;if(!id&&typeof name==="string"&&data===undefined){return null;}
if(!id){id=++uuid;}
if(typeof name==="object"){elem[expando]=id;thisCache=cache[id]=jQuery.extend(true,{},name);}else if(!cache[id]){elem[expando]=id;cache[id]={};}
thisCache=cache[id];if(data!==undefined){thisCache[name]=data;}
return typeof name==="string"?thisCache[name]:thisCache;},removeData:function(elem,name){if(elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()]){return;}
elem=elem==window?windowData:elem;var id=elem[expando],cache=jQuery.cache,thisCache=cache[id];if(name){if(thisCache){delete thisCache[name];if(jQuery.isEmptyObject(thisCache)){jQuery.removeData(elem);}}}else{if(jQuery.support.deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}});jQuery.fn.extend({data:function(key,value){if(typeof key==="undefined"&&this.length){return jQuery.data(this[0]);}else if(typeof key==="object"){return this.each(function(){jQuery.data(this,key);});}
var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length){data=jQuery.data(this[0],key);}
return data===undefined&&parts[1]?this.data(parts[0]):data;}else{return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});}},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});}});jQuery.extend({queue:function(elem,type,data){if(!elem){return;}
type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!data){return q||[];}
if(!q||jQuery.isArray(data)){q=jQuery.data(elem,type,jQuery.makeArray(data));}else{q.push(data);}
return q;},dequeue:function(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),fn=queue.shift();if(fn==="inprogress"){fn=queue.shift();}
if(fn){if(type==="fx"){queue.unshift("inprogress");}
fn.call(elem,function(){jQuery.dequeue(elem,type);});}}});jQuery.fn.extend({queue:function(type,data){if(typeof type!=="string"){data=type;type="fx";}
if(data===undefined){return jQuery.queue(this[0],type);}
return this.each(function(i,elem){var queue=jQuery.queue(this,type,data);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type);});},delay:function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(){var elem=this;setTimeout(function(){jQuery.dequeue(elem,type);},time);});},clearQueue:function(type){return this.queue(type||"fx",[]);}});var rclass=/[\n\t]/g,rspace=/\s+/,rreturn=/\r/g,rspecialurl=/href|src|style/,rtype=/(button|input)/i,rfocusable=/(button|input|object|select|textarea)/i,rclickable=/^(a|area)$/i,rradiocheck=/radio|checkbox/;jQuery.fn.extend({attr:function(name,value){return access(this,name,value,true,jQuery.attr);},removeAttr:function(name,fn){return this.each(function(){jQuery.attr(this,name,"");if(this.nodeType===1){this.removeAttribute(name);}});},addClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.addClass(value.call(this,i,self.attr("class")));});}
if(value&&typeof value==="string"){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1){if(!elem.className){elem.className=value;}else{var className=" "+elem.className+" ",setClass=elem.className;for(var c=0,cl=classNames.length;c<cl;c++){if(className.indexOf(" "+classNames[c]+" ")<0){setClass+=" "+classNames[c];}}
elem.className=jQuery.trim(setClass);}}}}
return this;},removeClass:function(value){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.removeClass(value.call(this,i,self.attr("class")));});}
if((value&&typeof value==="string")||value===undefined){var classNames=(value||"").split(rspace);for(var i=0,l=this.length;i<l;i++){var elem=this[i];if(elem.nodeType===1&&elem.className){if(value){var className=(" "+elem.className+" ").replace(rclass," ");for(var c=0,cl=classNames.length;c<cl;c++){className=className.replace(" "+classNames[c]+" "," ");}
elem.className=jQuery.trim(className);}else{elem.className="";}}}}
return this;},toggleClass:function(value,stateVal){var type=typeof value,isBool=typeof stateVal==="boolean";if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);self.toggleClass(value.call(this,i,self.attr("class"),stateVal),stateVal);});}
return this.each(function(){if(type==="string"){var className,i=0,self=jQuery(this),state=stateVal,classNames=value.split(rspace);while((className=classNames[i++])){state=isBool?state:!self.hasClass(className);self[state?"addClass":"removeClass"](className);}}else if(type==="undefined"||type==="boolean"){if(this.className){jQuery.data(this,"__className__",this.className);}
this.className=this.className||value===false?"":jQuery.data(this,"__className__")||"";}});},hasClass:function(selector){var className=" "+selector+" ";for(var i=0,l=this.length;i<l;i++){if((" "+this[i].className+" ").replace(rclass," ").indexOf(className)>-1){return true;}}
return false;},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,"option")){return(elem.attributes.value||{}).specified?elem.value:elem.text;}
if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type==="select-one";if(index<0){return null;}
for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one){return value;}
values.push(value);}}
return values;}
if(rradiocheck.test(elem.type)&&!jQuery.support.checkOn){return elem.getAttribute("value")===null?"on":elem.value;}
return(elem.value||"").replace(rreturn,"");}
return undefined;}
var isFunction=jQuery.isFunction(value);return this.each(function(i){var self=jQuery(this),val=value;if(this.nodeType!==1){return;}
if(isFunction){val=value.call(this,i,self.val());}
if(typeof val==="number"){val+="";}
if(jQuery.isArray(val)&&rradiocheck.test(this.type)){this.checked=jQuery.inArray(self.val(),val)>=0;}else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(val);jQuery("option",this).each(function(){this.selected=jQuery.inArray(jQuery(this).val(),values)>=0;});if(!values.length){this.selectedIndex=-1;}}else{this.value=val;}});}});jQuery.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(elem,name,value,pass){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if(pass&&name in jQuery.attrFn){return jQuery(elem)[name](value);}
var notxml=elem.nodeType!==1||!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.nodeType===1){var special=rspecialurl.test(name);if(name==="selected"&&!jQuery.support.optSelected){var parent=elem.parentNode;if(parent){parent.selectedIndex;if(parent.parentNode){parent.parentNode.selectedIndex;}}}
if(name in elem&&notxml&&!special){if(set){if(name==="type"&&rtype.test(elem.nodeName)&&elem.parentNode){jQuery.error("type property can't be changed");}
elem[name]=value;}
if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name)){return elem.getAttributeNode(name).nodeValue;}
if(name==="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:undefined;}
return elem[name];}
if(!jQuery.support.style&&notxml&&name==="style"){if(set){elem.style.cssText=""+value;}
return elem.style.cssText;}
if(set){elem.setAttribute(name,""+value);}
var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}
return jQuery.style(elem,name,value);}});var rnamespaces=/\.(.*)$/,fcleanup=function(nm){return nm.replace(/[^\w\s\.\|`]/g,function(ch){return"\\"+ch;});};jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType===3||elem.nodeType===8){return;}
if(elem.setInterval&&(elem!==window&&!elem.frameElement)){elem=window;}
var handleObjIn,handleObj;if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;}
if(!handler.guid){handler.guid=jQuery.guid++;}
var elemData=jQuery.data(elem);if(!elemData){return;}
var events=elemData.events=elemData.events||{},eventHandle=elemData.handle,eventHandle;if(!eventHandle){elemData.handle=eventHandle=function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(eventHandle.elem,arguments):undefined;};}
eventHandle.elem=elem;types=types.split(" ");var type,i=0,namespaces;while((type=types[i++])){handleObj=handleObjIn?jQuery.extend({},handleObjIn):{handler:handler,data:data};if(type.indexOf(".")>-1){namespaces=type.split(".");type=namespaces.shift();handleObj.namespace=namespaces.slice(0).sort().join(".");}else{namespaces=[];handleObj.namespace="";}
handleObj.type=type;handleObj.guid=handler.guid;var handlers=events[type],special=jQuery.event.special[type]||{};if(!handlers){handlers=events[type]=[];if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}}}
if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}
handlers.push(handleObj);jQuery.event.global[type]=true;}
elem=null;},global:{},remove:function(elem,types,handler,pos){if(elem.nodeType===3||elem.nodeType===8){return;}
var ret,type,fn,i=0,all,namespaces,namespace,special,eventType,handleObj,origType,elemData=jQuery.data(elem),events=elemData&&elemData.events;if(!elemData||!events){return;}
if(types&&types.type){handler=types.handler;types=types.type;}
if(!types||typeof types==="string"&&types.charAt(0)==="."){types=types||"";for(type in events){jQuery.event.remove(elem,type+types);}
return;}
types=types.split(" ");while((type=types[i++])){origType=type;handleObj=null;all=type.indexOf(".")<0;namespaces=[];if(!all){namespaces=type.split(".");type=namespaces.shift();namespace=new RegExp("(^|\\.)"+
jQuery.map(namespaces.slice(0).sort(),fcleanup).join("\\.(?:.*\\.)?")+"(\\.|$)")}
eventType=events[type];if(!eventType){continue;}
if(!handler){for(var j=0;j<eventType.length;j++){handleObj=eventType[j];if(all||namespace.test(handleObj.namespace)){jQuery.event.remove(elem,origType,handleObj.handler,j);eventType.splice(j--,1);}}
continue;}
special=jQuery.event.special[type]||{};for(var j=pos||0;j<eventType.length;j++){handleObj=eventType[j];if(handler.guid===handleObj.guid){if(all||namespace.test(handleObj.namespace)){if(pos==null){eventType.splice(j--,1);}
if(special.remove){special.remove.call(elem,handleObj);}}
if(pos!=null){break;}}}
if(eventType.length===0||pos!=null&&eventType.length===1){if(!special.teardown||special.teardown.call(elem,namespaces)===false){removeEvent(elem,type,elemData.handle);}
ret=null;delete events[type];}}
if(jQuery.isEmptyObject(events)){var handle=elemData.handle;if(handle){handle.elem=null;}
delete elemData.events;delete elemData.handle;if(jQuery.isEmptyObject(elemData)){jQuery.removeData(elem);}}},trigger:function(event,data,elem){var type=event.type||event,bubbling=arguments[3];if(!bubbling){event=typeof event==="object"?event[expando]?event:jQuery.extend(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true;}
if(!elem){event.stopPropagation();if(jQuery.event.global[type]){jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type]){jQuery.event.trigger(event,data,this.handle.elem);}});}}
if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event);}
event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle){handle.apply(elem,data);}
var parent=elem.parentNode||elem.ownerDocument;try{if(!(elem&&elem.nodeName&&jQuery.noData[elem.nodeName.toLowerCase()])){if(elem["on"+type]&&elem["on"+type].apply(elem,data)===false){event.result=false;}}}catch(e){}
if(!event.isPropagationStopped()&&parent){jQuery.event.trigger(event,data,parent,true);}else if(!event.isDefaultPrevented()){var target=event.target,old,isClick=jQuery.nodeName(target,"a")&&type==="click",special=jQuery.event.special[type]||{};if((!special._default||special._default.call(elem,event)===false)&&!isClick&&!(target&&target.nodeName&&jQuery.noData[target.nodeName.toLowerCase()])){try{if(target[type]){old=target["on"+type];if(old){target["on"+type]=null;}
jQuery.event.triggered=true;target[type]();}}catch(e){}
if(old){target["on"+type]=old;}
jQuery.event.triggered=false;}}},handle:function(event){var all,handlers,namespaces,namespace,events;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;all=event.type.indexOf(".")<0&&!event.exclusive;if(!all){namespaces=event.type.split(".");event.type=namespaces.shift();namespace=new RegExp("(^|\\.)"+namespaces.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");}
var events=jQuery.data(this,"events"),handlers=events[event.type];if(events&&handlers){handlers=handlers.slice(0);for(var j=0,l=handlers.length;j<l;j++){var handleObj=handlers[j];if(all||namespace.test(handleObj.namespace)){event.handler=handleObj.handler;event.data=handleObj.data;event.handleObj=handleObj;var ret=handleObj.handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}
if(event.isImmediatePropagationStopped()){break;}}}}
return event.result;},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando]){return event;}
var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop];}
if(!event.target){event.target=event.srcElement||document;}
if(event.target.nodeType===3){event.target=event.target.parentNode;}
if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement;}
if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}
if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode)){event.which=event.charCode||event.keyCode;}
if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey;}
if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));}
return event;},guid:1E8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(handleObj){jQuery.event.add(this,handleObj.origType,jQuery.extend({},handleObj,{handler:liveHandler}));},remove:function(handleObj){var remove=true,type=handleObj.origType.replace(rnamespaces,"");jQuery.each(jQuery.data(this,"events").live||[],function(){if(type===this.origType.replace(rnamespaces,"")){remove=false;return false;}});if(remove){jQuery.event.remove(this,handleObj.origType,liveHandler);}}},beforeunload:{setup:function(data,namespaces,eventHandle){if(this.setInterval){this.onbeforeunload=eventHandle;}
return false;},teardown:function(namespaces,eventHandle){if(this.onbeforeunload===eventHandle){this.onbeforeunload=null;}}}}};var removeEvent=document.removeEventListener?function(elem,type,handle){elem.removeEventListener(type,handle,false);}:function(elem,type,handle){elem.detachEvent("on"+type,handle);};jQuery.Event=function(src){if(!this.preventDefault){return new jQuery.Event(src);}
if(src&&src.type){this.originalEvent=src;this.type=src.type;}else{this.type=src;}
this.timeStamp=now();this[expando]=true;};function returnFalse(){return false;}
function returnTrue(){return true;}
jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.preventDefault){e.preventDefault();}
e.returnValue=false;},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return;}
if(e.stopPropagation){e.stopPropagation();}
e.cancelBubble=true;},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation();},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;try{while(parent&&parent!==this){parent=parent.parentNode;}
if(parent!==this){event.type=event.data;jQuery.event.handle.apply(this,arguments);}}catch(e){}},delegate=function(event){event.type=event.data;jQuery.event.handle.apply(this,arguments);};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(orig,fix){jQuery.event.special[orig]={setup:function(data){jQuery.event.add(this,fix,data&&data.selector?delegate:withinElement,orig);},teardown:function(data){jQuery.event.remove(this,fix,data&&data.selector?delegate:withinElement);}};});if(!jQuery.support.submitBubbles){jQuery.event.special.submit={setup:function(data,namespaces){if(this.nodeName.toLowerCase()!=="form"){jQuery.event.add(this,"click.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="submit"||type==="image")&&jQuery(elem).closest("form").length){return trigger("submit",this,arguments);}});jQuery.event.add(this,"keypress.specialSubmit",function(e){var elem=e.target,type=elem.type;if((type==="text"||type==="password")&&jQuery(elem).closest("form").length&&e.keyCode===13){return trigger("submit",this,arguments);}});}else{return false;}},teardown:function(namespaces){jQuery.event.remove(this,".specialSubmit");}};}
if(!jQuery.support.changeBubbles){var formElems=/textarea|input|select/i,changeFilters,getVal=function(elem){var type=elem.type,val=elem.value;if(type==="radio"||type==="checkbox"){val=elem.checked;}else if(type==="select-multiple"){val=elem.selectedIndex>-1?jQuery.map(elem.options,function(elem){return elem.selected;}).join("-"):"";}else if(elem.nodeName.toLowerCase()==="select"){val=elem.selectedIndex;}
return val;},testChange=function testChange(e){var elem=e.target,data,val;if(!formElems.test(elem.nodeName)||elem.readOnly){return;}
data=jQuery.data(elem,"_change_data");val=getVal(elem);if(e.type!=="focusout"||elem.type!=="radio"){jQuery.data(elem,"_change_data",val);}
if(data===undefined||val===data){return;}
if(data!=null||val){e.type="change";return jQuery.event.trigger(e,arguments[1],elem);}};jQuery.event.special.change={filters:{focusout:testChange,click:function(e){var elem=e.target,type=elem.type;if(type==="radio"||type==="checkbox"||elem.nodeName.toLowerCase()==="select"){return testChange.call(this,e);}},keydown:function(e){var elem=e.target,type=elem.type;if((e.keyCode===13&&elem.nodeName.toLowerCase()!=="textarea")||(e.keyCode===32&&(type==="checkbox"||type==="radio"))||type==="select-multiple"){return testChange.call(this,e);}},beforeactivate:function(e){var elem=e.target;jQuery.data(elem,"_change_data",getVal(elem));}},setup:function(data,namespaces){if(this.type==="file"){return false;}
for(var type in changeFilters){jQuery.event.add(this,type+".specialChange",changeFilters[type]);}
return formElems.test(this.nodeName);},teardown:function(namespaces){jQuery.event.remove(this,".specialChange");return formElems.test(this.nodeName);}};changeFilters=jQuery.event.special.change.filters;}
function trigger(type,elem,args){args[0].type=type;return jQuery.event.handle.apply(elem,args);}
if(document.addEventListener){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){jQuery.event.special[fix]={setup:function(){this.addEventListener(orig,handler,true);},teardown:function(){this.removeEventListener(orig,handler,true);}};function handler(e){e=jQuery.event.fix(e);e.type=fix;return jQuery.event.handle.call(this,e);}});}
jQuery.each(["bind","one"],function(i,name){jQuery.fn[name]=function(type,data,fn){if(typeof type==="object"){for(var key in type){this[name](key,data,type[key],fn);}
return this;}
if(jQuery.isFunction(data)){fn=data;data=undefined;}
var handler=name==="one"?jQuery.proxy(fn,function(event){jQuery(this).unbind(event,handler);return fn.apply(this,arguments);}):fn;if(type==="unload"&&name!=="one"){this.one(type,data,fn);}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.add(this[i],type,handler,data);}}
return this;};});jQuery.fn.extend({unbind:function(type,fn){if(typeof type==="object"&&!type.preventDefault){for(var key in type){this.unbind(key,type[key]);}}else{for(var i=0,l=this.length;i<l;i++){jQuery.event.remove(this[i],type,fn);}}
return this;},delegate:function(selector,types,data,fn){return this.live(types,data,fn,selector);},undelegate:function(selector,types,fn){if(arguments.length===0){return this.unbind("live");}else{return this.die(types,null,fn,selector);}},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result;}},toggle:function(fn){var args=arguments,i=1;while(i<args.length){jQuery.proxy(fn,args[i++]);}
return this.click(jQuery.proxy(fn,function(event){var lastToggle=(jQuery.data(this,"lastToggle"+fn.guid)||0)%i;jQuery.data(this,"lastToggle"+fn.guid,lastToggle+1);event.preventDefault();return args[lastToggle].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);}});var liveMap={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};jQuery.each(["live","die"],function(i,name){jQuery.fn[name]=function(types,data,fn,origSelector){var type,i=0,match,namespaces,preType,selector=origSelector||this.selector,context=origSelector?this:jQuery(this.context);if(jQuery.isFunction(data)){fn=data;data=undefined;}
types=(types||"").split(" ");while((type=types[i++])!=null){match=rnamespaces.exec(type);namespaces="";if(match){namespaces=match[0];type=type.replace(rnamespaces,"");}
if(type==="hover"){types.push("mouseenter"+namespaces,"mouseleave"+namespaces);continue;}
preType=type;if(type==="focus"||type==="blur"){types.push(liveMap[type]+namespaces);type=type+namespaces;}else{type=(liveMap[type]||type)+namespaces;}
if(name==="live"){context.each(function(){jQuery.event.add(this,liveConvert(type,selector),{data:data,selector:selector,handler:fn,origType:type,origHandler:fn,preType:preType});});}else{context.unbind(liveConvert(type,selector),fn);}}
return this;}});function liveHandler(event){var stop,elems=[],selectors=[],args=arguments,related,match,handleObj,elem,j,i,l,data,events=jQuery.data(this,"events");if(event.liveFired===this||!events||!events.live||event.button&&event.type==="click"){return;}
event.liveFired=this;var live=events.live.slice(0);for(j=0;j<live.length;j++){handleObj=live[j];if(handleObj.origType.replace(rnamespaces,"")===event.type){selectors.push(handleObj.selector);}else{live.splice(j--,1);}}
match=jQuery(event.target).closest(selectors,event.currentTarget);for(i=0,l=match.length;i<l;i++){for(j=0;j<live.length;j++){handleObj=live[j];if(match[i].selector===handleObj.selector){elem=match[i].elem;related=null;if(handleObj.preType==="mouseenter"||handleObj.preType==="mouseleave"){related=jQuery(event.relatedTarget).closest(handleObj.selector)[0];}
if(!related||related!==elem){elems.push({elem:elem,handleObj:handleObj});}}}}
for(i=0,l=elems.length;i<l;i++){match=elems[i];event.currentTarget=match.elem;event.data=match.handleObj.data;event.handleObj=match.handleObj;if(match.handleObj.origHandler.apply(match.elem,args)===false){stop=false;break;}}
return stop;}
function liveConvert(type,selector){return"live."+(type&&type!=="*"?type+".":"")+selector.replace(/\./g,"`").replace(/ /g,"&");}
jQuery.each(("blur focus focusin focusout load resize scroll unload click dblclick "+"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+"change select submit keydown keypress keyup error").split(" "),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};if(jQuery.attrFn){jQuery.attrFn[name]=true;}});if(window.attachEvent&&!window.addEventListener){window.attachEvent("onunload",function(){for(var id in jQuery.cache){if(jQuery.cache[id].handle){try{jQuery.event.remove(jQuery.cache[id].handle.elem);}catch(e){}}}});}
(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;[0,0].sort(function(){baseHasDuplicate=false;return 0;});var Sizzle=function(selector,context,results,seed){results=results||[];var origContext=context=context||document;if(context.nodeType!==1&&context.nodeType!==9){return[];}
if(!selector||typeof selector!=="string"){return results;}
var parts=[],m,set,checkSet,extra,prune=true,contextXML=isXML(context),soFar=selector;while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];parts.push(m[1]);if(m[2]){extra=m[3];break;}}
if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context);}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector]){selector+=parts.shift();}
set=posProcess(selector,set);}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0];}
if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;if(parts.length>0){checkSet=makeArray(set);}else{prune=false;}
while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur="";}else{pop=parts.pop();}
if(pop==null){pop=context;}
Expr.relative[cur](checkSet,pop,contextXML);}}else{checkSet=parts=[];}}
if(!checkSet){checkSet=set;}
if(!checkSet){Sizzle.error(cur||selector);}
if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet);}else if(context&&context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i]);}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i]);}}}}else{makeArray(checkSet,results);}
if(extra){Sizzle(extra,origContext,results,seed);Sizzle.uniqueSort(results);}
return results;};Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1);}}}}
return results;};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set);};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[];}
for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];match.splice(1,1);if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break;}}}}
if(!set){set=context.getElementsByTagName("*");}
return{set:set,expr:expr};};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.leftMatch[type].exec(expr))!=null&&match[2]){var filter=Expr.filter[type],found,item,left=match[1];anyFound=false;match.splice(1,1);if(left.substr(left.length-1)==="\\"){continue;}
if(curLoop===result){result=[];}
if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true;}else if(match===true){continue;}}
if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true;}else{curLoop[i]=false;}}else if(pass){result.push(item);anyFound=true;}}}}
if(found!==undefined){if(!inplace){curLoop=result;}
expr=expr.replace(Expr.match[type],"");if(!anyFound){return[];}
break;}}}
if(expr===old){if(anyFound==null){Sizzle.error(expr);}else{break;}}
old=expr;}
return curLoop;};Sizzle.error=function(msg){throw"Syntax error, unrecognized expression: "+msg;};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href");}},relative:{"+":function(checkSet,part){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag){part=part.toLowerCase();}
for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}
checkSet[i]=isPartStrNotTag||elem&&elem.nodeName.toLowerCase()===part?elem||false:elem===part;}}
if(isPartStrNotTag){Sizzle.filter(part,checkSet,true);}},">":function(checkSet,part){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=part.toLowerCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName.toLowerCase()===part?parent:false;}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part;}}
if(isPartStr){Sizzle.filter(part,checkSet,true);}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML);},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=part.toLowerCase();checkFn=dirNodeCheck;}
checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML);}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[];}},NAME:function(match,context){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i]);}}
return ret.length===0?null:ret;}},TAG:function(match,context){return context.getElementsByTagName(match[1]);}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match;}
for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").replace(/[\t\n]/g," ").indexOf(match)>=0)){if(!inplace){result.push(elem);}}else if(inplace){curLoop[i]=false;}}}
return false;},ID:function(match){return match[1].replace(/\\/g,"");},TAG:function(match,curLoop){return match[1].toLowerCase();},CHILD:function(match){if(match[1]==="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]==="even"&&"2n"||match[2]==="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0;}
match[0]=done++;return match;},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name];}
if(match[2]==="~="){match[4]=" "+match[4]+" ";}
return match;},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop);}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret);}
return false;}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true;}
return match;},POS:function(match){match.unshift(true);return match;}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden";},disabled:function(elem){return elem.disabled===true;},checked:function(elem){return elem.checked===true;},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true;},parent:function(elem){return!!elem.firstChild;},empty:function(elem){return!elem.firstChild;},has:function(elem,i,match){return!!Sizzle(match[3],elem).length;},header:function(elem){return/h\d/i.test(elem.nodeName);},text:function(elem){return"text"===elem.type;},radio:function(elem){return"radio"===elem.type;},checkbox:function(elem){return"checkbox"===elem.type;},file:function(elem){return"file"===elem.type;},password:function(elem){return"password"===elem.type;},submit:function(elem){return"submit"===elem.type;},image:function(elem){return"image"===elem.type;},reset:function(elem){return"reset"===elem.type;},button:function(elem){return"button"===elem.type||elem.nodeName.toLowerCase()==="button";},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName);}},setFilters:{first:function(elem,i){return i===0;},last:function(elem,i,match,array){return i===array.length-1;},even:function(elem,i){return i%2===0;},odd:function(elem,i){return i%2===1;},lt:function(elem,i,match){return i<match[3]-0;},gt:function(elem,i,match){return i>match[3]-0;},nth:function(elem,i,match){return match[3]-0===i;},eq:function(elem,i,match){return match[3]-0===i;}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array);}else if(name==="contains"){return(elem.textContent||elem.innerText||getText([elem])||"").indexOf(match[3])>=0;}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false;}}
return true;}else{Sizzle.error("Syntax error, unrecognized expression: "+name);}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while((node=node.previousSibling)){if(node.nodeType===1){return false;}}
if(type==="first"){return true;}
node=elem;case'last':while((node=node.nextSibling)){if(node.nodeType===1){return false;}}
return true;case'nth':var first=match[2],last=match[3];if(first===1&&last===0){return true;}
var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count;}}
parent.sizcache=doneName;}
var diff=elem.nodeIndex-last;if(first===0){return diff===0;}else{return(diff%first===0&&diff/first>=0);}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match;},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName.toLowerCase()===match;},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1;},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!==check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false;},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array);}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source.replace(/\\(\d+)/g,function(all,num){return"\\"+(num-0+1);}));}
var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);if(results){results.push.apply(results,array);return results;}
return array;};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType;}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array);}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i]);}}else{for(var i=0;array[i];i++){ret.push(array[i]);}}}
return ret;};}
var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true;}
return a.compareDocumentPosition?-1:1;}
var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true;}
return ret;};}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true;}
return a.sourceIndex?-1:1;}
var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true;}
return ret;};}else if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true;}
return a.ownerDocument?-1:1;}
var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.setStart(a,0);aRange.setEnd(a,0);bRange.setStart(b,0);bRange.setEnd(b,0);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true;}
return ret;};}
function getText(elems){var ret="",elem;for(var i=0;elems[i];i++){elem=elems[i];if(elem.nodeType===3||elem.nodeType===4){ret+=elem.nodeValue;}else if(elem.nodeType!==8){ret+=getText(elem.childNodes);}}
return ret;}
(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();form.innerHTML="<a name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[];}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match;};}
root.removeChild(form);root=form=null;})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i]);}}
results=tmp;}
return results;};}
div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2);};}
div=null;})();if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return;}
Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra);}catch(e){}}
return oldSizzle(query,context,extra,seed);};for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop];}
div=null;})();}
(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(!div.getElementsByClassName||div.getElementsByClassName("e").length===0){return;}
div.lastChild.className="e";if(div.getElementsByClassName("e").length===1){return;}
Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1]);}};div=null;})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(elem.nodeName.toLowerCase()===cur){match=elem;break;}
elem=elem[dir];}
checkSet[i]=match;}}}
function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break;}
if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i;}
if(typeof cur!=="string"){if(elem===cur){match=true;break;}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break;}}
elem=elem[dir];}
checkSet[i]=match;}}}
var contains=document.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16);}:function(a,b){return a!==b&&(a.contains?a.contains(b):true);};var isXML=function(elem){var documentElement=(elem?elem.ownerDocument||elem:0).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"");}
selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet);}
return Sizzle.filter(later,tmpSet);};jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=Sizzle.uniqueSort;jQuery.text=getText;jQuery.isXMLDoc=isXML;jQuery.contains=contains;return;window.Sizzle=Sizzle;})();var runtil=/Until$/,rparentsprev=/^(?:parents|prevUntil|prevAll)/,rmultiselector=/,/,slice=Array.prototype.slice;var winnow=function(elements,qualifier,keep){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){return!!qualifier.call(elem,i,elem)===keep;});}else if(qualifier.nodeType){return jQuery.grep(elements,function(elem,i){return(elem===qualifier)===keep;});}else if(typeof qualifier==="string"){var filtered=jQuery.grep(elements,function(elem){return elem.nodeType===1;});if(isSimple.test(qualifier)){return jQuery.filter(qualifier,filtered,!keep);}else{qualifier=jQuery.filter(qualifier,filtered);}}
return jQuery.grep(elements,function(elem,i){return(jQuery.inArray(elem,qualifier)>=0)===keep;});};jQuery.fn.extend({find:function(selector){var ret=this.pushStack("","find",selector),length=0;for(var i=0,l=this.length;i<l;i++){length=ret.length;jQuery.find(selector,this[i],ret);if(i>0){for(var n=length;n<ret.length;n++){for(var r=0;r<length;r++){if(ret[r]===ret[n]){ret.splice(n--,1);break;}}}}}
return ret;},has:function(target){var targets=jQuery(target);return this.filter(function(){for(var i=0,l=targets.length;i<l;i++){if(jQuery.contains(this,targets[i])){return true;}}});},not:function(selector){return this.pushStack(winnow(this,selector,false),"not",selector);},filter:function(selector){return this.pushStack(winnow(this,selector,true),"filter",selector);},is:function(selector){return!!selector&&jQuery.filter(selector,this).length>0;},closest:function(selectors,context){if(jQuery.isArray(selectors)){var ret=[],cur=this[0],match,matches={},selector;if(cur&&selectors.length){for(var i=0,l=selectors.length;i<l;i++){selector=selectors[i];if(!matches[selector]){matches[selector]=jQuery.expr.match.POS.test(selector)?jQuery(selector,context||this.context):selector;}}
while(cur&&cur.ownerDocument&&cur!==context){for(selector in matches){match=matches[selector];if(match.jquery?match.index(cur)>-1:jQuery(cur).is(match)){ret.push({selector:selector,elem:cur});delete matches[selector];}}
cur=cur.parentNode;}}
return ret;}
var pos=jQuery.expr.match.POS.test(selectors)?jQuery(selectors,context||this.context):null;return this.map(function(i,cur){while(cur&&cur.ownerDocument&&cur!==context){if(pos?pos.index(cur)>-1:jQuery(cur).is(selectors)){return cur;}
cur=cur.parentNode;}
return null;});},index:function(elem){if(!elem||typeof elem==="string"){return jQuery.inArray(this[0],elem?jQuery(elem):this.parent().children());}
return jQuery.inArray(elem.jquery?elem[0]:elem,this);},add:function(selector,context){var set=typeof selector==="string"?jQuery(selector,context||this.context):jQuery.makeArray(selector),all=jQuery.merge(this.get(),set);return this.pushStack(isDisconnected(set[0])||isDisconnected(all[0])?all:jQuery.unique(all));},andSelf:function(){return this.add(this.prevObject);}});function isDisconnected(node){return!node||!node.parentNode||node.parentNode.nodeType===11;}
jQuery.each({parent:function(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(!runtil.test(name)){selector=until;}
if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}
ret=this.length>1?jQuery.unique(ret):ret;if((this.length>1||rmultiselector.test(selector))&&rparentsprev.test(name)){ret=ret.reverse();}
return this.pushStack(ret,name,slice.call(arguments).join(","));};});jQuery.extend({filter:function(expr,elems,not){if(not){expr=":not("+expr+")";}
return jQuery.find.matches(expr,elems);},dir:function(elem,dir,until){var matched=[],cur=elem[dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}
cur=cur[dir];}
return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir]){if(cur.nodeType===1&&++num===result){break;}}
return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}
return r;}});var rinlinejQuery=/ jQuery\d+="(?:\d+|null)"/g,rleadingWhitespace=/^\s+/,rxhtmlTag=/(<([\w:]+)[^>]*?)\/>/g,rselfClosing=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnocache=/<script|<object|<embed|<option|<style/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,fcloseTag=function(all,front,tag){return rselfClosing.test(tag)?all:front+"></"+tag+">";},wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;if(!jQuery.support.htmlSerialize){wrapMap._default=[1,"div<div>","</div>"];}
jQuery.fn.extend({text:function(text){if(jQuery.isFunction(text)){return this.each(function(i){var self=jQuery(this);self.text(text.call(this,i,self.text()));});}
if(typeof text!=="object"&&text!==undefined){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));}
return jQuery.text(this);},wrapAll:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}
if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}
wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}
return elem;}).append(this);}
return this;},wrapInner:function(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}
return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},unwrap:function(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.appendChild(elem);}});},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType===1){this.insertBefore(elem,this.firstChild);}});},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this);});}else if(arguments.length){var set=jQuery(arguments[0]);set.push.apply(set,this.toArray());return this.pushStack(set,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});}else if(arguments.length){var set=this.pushStack(this,"after",arguments);set.push.apply(set,jQuery(arguments[0]).toArray());return set;}},remove:function(selector,keepData){for(var i=0,elem;(elem=this[i])!=null;i++){if(!selector||jQuery.filter(selector,[elem]).length){if(!keepData&&elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));jQuery.cleanData([elem]);}
if(elem.parentNode){elem.parentNode.removeChild(elem);}}}
return this;},empty:function(){for(var i=0,elem;(elem=this[i])!=null;i++){if(elem.nodeType===1){jQuery.cleanData(elem.getElementsByTagName("*"));}
while(elem.firstChild){elem.removeChild(elem.firstChild);}}
return this;},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML,ownerDocument=this.ownerDocument;if(!html){var div=ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML;}
return jQuery.clean([html.replace(rinlinejQuery,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(rleadingWhitespace,"")],ownerDocument)[0];}else{return this.cloneNode(true);}});if(events===true){cloneCopyEvent(this,ret);cloneCopyEvent(this.find("*"),ret.find("*"));}
return ret;},html:function(value){if(value===undefined){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(rinlinejQuery,""):null;}else if(typeof value==="string"&&!rnocache.test(value)&&(jQuery.support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,fcloseTag);try{for(var i=0,l=this.length;i<l;i++){if(this[i].nodeType===1){jQuery.cleanData(this[i].getElementsByTagName("*"));this[i].innerHTML=value;}}}catch(e){this.empty().append(value);}}else if(jQuery.isFunction(value)){this.each(function(i){var self=jQuery(this),old=self.html();self.empty().append(function(){return value.call(this,i,old);});});}else{this.empty().append(value);}
return this;},replaceWith:function(value){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this),old=self.html();self.replaceWith(value.call(this,i,old));});}
if(typeof value!=="string"){value=jQuery(value).detach();}
return this.each(function(){var next=this.nextSibling,parent=this.parentNode;jQuery(this).remove();if(next){jQuery(next).before(value);}else{jQuery(parent).append(value);}});}else{return this.pushStack(jQuery(jQuery.isFunction(value)?value():value),"replaceWith",value);}},detach:function(selector){return this.remove(selector,true);},domManip:function(args,table,callback){var results,first,value=args[0],scripts=[],fragment,parent;if(!jQuery.support.checkClone&&arguments.length===3&&typeof value==="string"&&rchecked.test(value)){return this.each(function(){jQuery(this).domManip(args,table,callback,true);});}
if(jQuery.isFunction(value)){return this.each(function(i){var self=jQuery(this);args[0]=value.call(this,i,table?self.html():undefined);self.domManip(args,table,callback);});}
if(this[0]){parent=value&&value.parentNode;if(jQuery.support.parentNode&&parent&&parent.nodeType===11&&parent.childNodes.length===this.length){results={fragment:parent};}else{results=buildFragment(args,this,scripts);}
fragment=results.fragment;if(fragment.childNodes.length===1){first=fragment=fragment.firstChild;}else{first=fragment.firstChild;}
if(first){table=table&&jQuery.nodeName(first,"tr");for(var i=0,l=this.length;i<l;i++){callback.call(table?root(this[i],first):this[i],i>0||results.cacheable||this.length>1?fragment.cloneNode(true):fragment);}}
if(scripts.length){jQuery.each(scripts,evalScript);}}
return this;function root(elem,cur){return jQuery.nodeName(elem,"table")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem;}}});function cloneCopyEvent(orig,ret){var i=0;ret.each(function(){if(this.nodeName!==(orig[i]&&orig[i].nodeName)){return;}
var oldData=jQuery.data(orig[i++]),curData=jQuery.data(this,oldData),events=oldData&&oldData.events;if(events){delete curData.handle;curData.events={};for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data);}}}});}
function buildFragment(args,nodes,scripts){var fragment,cacheable,cacheresults,doc=(nodes&&nodes[0]?nodes[0].ownerDocument||nodes[0]:document);if(args.length===1&&typeof args[0]==="string"&&args[0].length<512&&doc===document&&!rnocache.test(args[0])&&(jQuery.support.checkClone||!rchecked.test(args[0]))){cacheable=true;cacheresults=jQuery.fragments[args[0]];if(cacheresults){if(cacheresults!==1){fragment=cacheresults;}}}
if(!fragment){fragment=doc.createDocumentFragment();jQuery.clean(args,doc,fragment,scripts);}
if(cacheable){jQuery.fragments[args[0]]=cacheresults?fragment:1;}
return{fragment:fragment,cacheable:cacheable};}
jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),parent=this.length===1&&this[0].parentNode;if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);return this;}else{for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
return this.pushStack(ret,name,insert.selector);}};});jQuery.extend({clean:function(elems,context,fragment,scripts){context=context||document;if(typeof context.createElement==="undefined"){context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;}
var ret=[];for(var i=0,elem;(elem=elems[i])!=null;i++){if(typeof elem==="number"){elem+="";}
if(!elem){continue;}
if(typeof elem==="string"&&!rhtml.test(elem)){elem=context.createTextNode(elem);}else if(typeof elem==="string"){elem=elem.replace(rxhtmlTag,fcloseTag);var tag=(rtagName.exec(elem)||["",""])[1].toLowerCase(),wrap=wrapMap[tag]||wrapMap._default,depth=wrap[0],div=context.createElement("div");div.innerHTML=wrap[1]+elem+wrap[2];while(depth--){div=div.lastChild;}
if(!jQuery.support.tbody){var hasBody=rtbody.test(elem),tbody=tag==="table"&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]==="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j){if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length){tbody[j].parentNode.removeChild(tbody[j]);}}}
if(!jQuery.support.leadingWhitespace&&rleadingWhitespace.test(elem)){div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]),div.firstChild);}
elem=div.childNodes;}
if(elem.nodeType){ret.push(elem);}else{ret=jQuery.merge(ret,elem);}}
if(fragment){for(var i=0;ret[i];i++){if(scripts&&jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i]);}else{if(ret[i].nodeType===1){ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));}
fragment.appendChild(ret[i]);}}}
return ret;},cleanData:function(elems){var data,id,cache=jQuery.cache,special=jQuery.event.special,deleteExpando=jQuery.support.deleteExpando;for(var i=0,elem;(elem=elems[i])!=null;i++){id=elem[jQuery.expando];if(id){data=cache[id];if(data.events){for(var type in data.events){if(special[type]){jQuery.event.remove(elem,type);}else{removeEvent(elem,type,data.handle);}}}
if(deleteExpando){delete elem[jQuery.expando];}else if(elem.removeAttribute){elem.removeAttribute(jQuery.expando);}
delete cache[id];}}}});var rexclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,ralpha=/alpha\([^)]*\)/,ropacity=/opacity=([^)]*)/,rfloat=/float/i,rdashAlpha=/-([a-z])/ig,rupper=/([A-Z])/g,rnumpx=/^-?\d+(?:px)?$/i,rnum=/^-?\d/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssWidth=["Left","Right"],cssHeight=["Top","Bottom"],getComputedStyle=document.defaultView&&document.defaultView.getComputedStyle,styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat",fcamelCase=function(all,letter){return letter.toUpperCase();};jQuery.fn.css=function(name,value){return access(this,name,value,true,function(elem,name,value){if(value===undefined){return jQuery.curCSS(elem,name);}
if(typeof value==="number"&&!rexclude.test(name)){value+="px";}
jQuery.style(elem,name,value);});};jQuery.extend({style:function(elem,name,value){if(!elem||elem.nodeType===3||elem.nodeType===8){return undefined;}
if((name==="width"||name==="height")&&parseFloat(value)<0){value=undefined;}
var style=elem.style||elem,set=value!==undefined;if(!jQuery.support.opacity&&name==="opacity"){if(set){style.zoom=1;var opacity=parseInt(value,10)+""==="NaN"?"":"alpha(opacity="+value*100+")";var filter=style.filter||jQuery.curCSS(elem,"filter")||"";style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):opacity;}
return style.filter&&style.filter.indexOf("opacity=")>=0?(parseFloat(ropacity.exec(style.filter)[1])/100)+"":"";}
if(rfloat.test(name)){name=styleFloat;}
name=name.replace(rdashAlpha,fcamelCase);if(set){style[name]=value;}
return style[name];},css:function(elem,name,force,extra){if(name==="width"||name==="height"){var val,props=cssShow,which=name==="width"?cssWidth:cssHeight;function getWH(){val=name==="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border"){return;}
jQuery.each(which,function(){if(!extra){val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;}
if(extra==="margin"){val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;}else{val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;}});}
if(elem.offsetWidth!==0){getWH();}else{jQuery.swap(elem,props,getWH);}
return Math.max(0,Math.round(val));}
return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style,filter;if(!jQuery.support.opacity&&name==="opacity"&&elem.currentStyle){ret=ropacity.test(elem.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return ret===""?"1":ret;}
if(rfloat.test(name)){name=styleFloat;}
if(!force&&style&&style[name]){ret=style[name];}else if(getComputedStyle){if(rfloat.test(name)){name="float";}
name=name.replace(rupper,"-$1").toLowerCase();var defaultView=elem.ownerDocument.defaultView;if(!defaultView){return null;}
var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle){ret=computedStyle.getPropertyValue(name);}
if(name==="opacity"&&ret===""){ret="1";}}else if(elem.currentStyle){var camelCase=name.replace(rdashAlpha,fcamelCase);ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!rnumpx.test(ret)&&rnum.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=camelCase==="fontSize"?"1em":(ret||0);ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}
return ret;},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}
callback.call(elem);for(var name in options){elem.style[name]=old[name];}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(elem){var width=elem.offsetWidth,height=elem.offsetHeight,skip=elem.nodeName.toLowerCase()==="tr";return width===0&&height===0&&!skip?true:width>0&&height>0&&!skip?false:jQuery.curCSS(elem,"display")==="none";};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};}
var jsc=now(),rscript=/<script(.|\s)*?\/script>/gi,rselectTextarea=/select|textarea/i,rinput=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,jsre=/=\?(&|$)/,rquery=/\?/,rts=/(\?|&)_=.*?(&|$)/,rurl=/^(\w+:)?\/\/([^\/?#]+)/,r20=/%20/g,_load=jQuery.fn.load;jQuery.fn.extend({load:function(url,params,callback){if(typeof url!=="string"){return _load.call(this,url);}else if(!this.length){return this;}
var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}
var type="GET";if(params){if(jQuery.isFunction(params)){callback=params;params=null;}else if(typeof params==="object"){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type="POST";}}
var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status==="success"||status==="notmodified"){self.html(selector?jQuery("<div />").append(res.responseText.replace(rscript,"")).find(selector):res.responseText);}
if(callback){self.each(callback,[res.responseText,status,res]);}}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||rselectTextarea.test(this.nodeName)||rinput.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data=null;}
return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){type=type||callback;callback=data;data={};}
return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:window.XMLHttpRequest&&(window.location.protocol!=="file:"||!window.ActiveXObject)?function(){return new window.XMLHttpRequest();}:function(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(origSettings){var s=jQuery.extend(true,{},jQuery.ajaxSettings,origSettings);var jsonp,status,data,callbackContext=origSettings&&origSettings.context||s,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}
if(s.dataType==="jsonp"){if(type==="GET"){if(!jsre.test(s.url)){s.url+=(rquery.test(s.url)?"&":"?")+(s.jsonp||"callback")+"=?";}}else if(!s.data||!jsre.test(s.data)){s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";}
s.dataType="json";}
if(s.dataType==="json"&&(s.data&&jsre.test(s.data)||jsre.test(s.url))){jsonp=s.jsonpCallback||("jsonp"+jsc++);if(s.data){s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");}
s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=window[jsonp]||function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}
if(head){head.removeChild(script);}};}
if(s.dataType==="script"&&s.cache===null){s.cache=false;}
if(s.cache===false&&type==="GET"){var ts=now();var ret=s.url.replace(rts,"$1_="+ts+"$2");s.url=ret+((ret===s.url)?(rquery.test(s.url)?"&":"?")+"_="+ts:"");}
if(s.data&&type==="GET"){s.url+=(rquery.test(s.url)?"&":"?")+s.data;}
if(s.global&&!jQuery.active++){jQuery.event.trigger("ajaxStart");}
var parts=rurl.exec(s.url),remote=parts&&(parts[1]&&parts[1]!==location.protocol||parts[2]!==location.host);if(s.dataType==="script"&&type==="GET"&&remote){var head=document.getElementsByTagName("head")[0]||document.documentElement;var script=document.createElement("script");script.src=s.url;if(s.scriptCharset){script.charset=s.scriptCharset;}
if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;if(head&&script.parentNode){head.removeChild(script);}}};}
head.insertBefore(script,head.firstChild);return undefined;}
var requestDone=false;var xhr=s.xhr();if(!xhr){return;}
if(s.username){xhr.open(type,s.url,s.async,s.username,s.password);}else{xhr.open(type,s.url,s.async);}
try{if(s.data||origSettings&&origSettings.contentType){xhr.setRequestHeader("Content-Type",s.contentType);}
if(s.ifModified){if(jQuery.lastModified[s.url]){xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]);}
if(jQuery.etag[s.url]){xhr.setRequestHeader("If-None-Match",jQuery.etag[s.url]);}}
if(!remote){xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");}
xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}
if(s.beforeSend&&s.beforeSend.call(callbackContext,xhr,s)===false){if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}
xhr.abort();return false;}
if(s.global){trigger("ajaxSend",[xhr,s]);}
var onreadystatechange=xhr.onreadystatechange=function(isTimeout){if(!xhr||xhr.readyState===0||isTimeout==="abort"){if(!requestDone){complete();}
requestDone=true;if(xhr){xhr.onreadystatechange=jQuery.noop;}}else if(!requestDone&&xhr&&(xhr.readyState===4||isTimeout==="timeout")){requestDone=true;xhr.onreadystatechange=jQuery.noop;status=isTimeout==="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";var errMsg;if(status==="success"){try{data=jQuery.httpData(xhr,s.dataType,s);}catch(err){status="parsererror";errMsg=err;}}
if(status==="success"||status==="notmodified"){if(!jsonp){success();}}else{jQuery.handleError(s,xhr,status,errMsg);}
complete();if(isTimeout==="timeout"){xhr.abort();}
if(s.async){xhr=null;}}};try{var oldAbort=xhr.abort;xhr.abort=function(){if(xhr){oldAbort.call(xhr);}
onreadystatechange("abort");};}catch(e){}
if(s.async&&s.timeout>0){setTimeout(function(){if(xhr&&!requestDone){onreadystatechange("timeout");}},s.timeout);}
try{xhr.send(type==="POST"||type==="PUT"||type==="DELETE"?s.data:null);}catch(e){jQuery.handleError(s,xhr,null,e);complete();}
if(!s.async){onreadystatechange();}
function success(){if(s.success){s.success.call(callbackContext,data,status,xhr);}
if(s.global){trigger("ajaxSuccess",[xhr,s]);}}
function complete(){if(s.complete){s.complete.call(callbackContext,xhr,status);}
if(s.global){trigger("ajaxComplete",[xhr,s]);}
if(s.global&&!--jQuery.active){jQuery.event.trigger("ajaxStop");}}
function trigger(type,args){(s.context?jQuery(s.context):jQuery.event).trigger(type,args);}
return xhr;},handleError:function(s,xhr,status,e){if(s.error){s.error.call(s.context||s,xhr,status,e);}
if(s.global){(s.context?jQuery(s.context):jQuery.event).trigger("ajaxError",[xhr,s,e]);}},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol==="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status===304||xhr.status===1223||xhr.status===0;}catch(e){}
return false;},httpNotModified:function(xhr,url){var lastModified=xhr.getResponseHeader("Last-Modified"),etag=xhr.getResponseHeader("Etag");if(lastModified){jQuery.lastModified[url]=lastModified;}
if(etag){jQuery.etag[url]=etag;}
return xhr.status===304||xhr.status===0;},httpData:function(xhr,type,s){var ct=xhr.getResponseHeader("content-type")||"",xml=type==="xml"||!type&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.nodeName==="parsererror"){jQuery.error("parsererror");}
if(s&&s.dataFilter){data=s.dataFilter(data,type);}
if(typeof data==="string"){if(type==="json"||!type&&ct.indexOf("json")>=0){data=jQuery.parseJSON(data);}else if(type==="script"||!type&&ct.indexOf("javascript")>=0){jQuery.globalEval(data);}}
return data;},param:function(a,traditional){var s=[];if(traditional===undefined){traditional=jQuery.ajaxSettings.traditional;}
if(jQuery.isArray(a)||a.jquery){jQuery.each(a,function(){add(this.name,this.value);});}else{for(var prefix in a){buildParams(prefix,a[prefix]);}}
return s.join("&").replace(r20,"+");function buildParams(prefix,obj){if(jQuery.isArray(obj)){jQuery.each(obj,function(i,v){if(traditional||/\[\]$/.test(prefix)){add(prefix,v);}else{buildParams(prefix+"["+(typeof v==="object"||jQuery.isArray(v)?i:"")+"]",v);}});}else if(!traditional&&obj!=null&&typeof obj==="object"){jQuery.each(obj,function(k,v){buildParams(prefix+"["+k+"]",v);});}else{add(prefix,obj);}}
function add(key,value){value=jQuery.isFunction(value)?value():value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);}}});var elemdisplay={},rfxtypes=/toggle|show|hide/,rfxnum=/^([+-]=)?([\d+-.]+)(.*)$/,timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];jQuery.fn.extend({show:function(speed,callback){if(speed||speed===0){return this.animate(genFx("show",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var nodeName=this[i].nodeName,display;if(elemdisplay[nodeName]){display=elemdisplay[nodeName];}else{var elem=jQuery("<"+nodeName+" />").appendTo("body");display=elem.css("display");if(display==="none"){display="block";}
elem.remove();elemdisplay[nodeName]=display;}
jQuery.data(this[i],"olddisplay",display);}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display=jQuery.data(this[j],"olddisplay")||"";}
return this;}},hide:function(speed,callback){if(speed||speed===0){return this.animate(genFx("hide",3),speed,callback);}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none"){jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"));}}
for(var j=0,k=this.length;j<k;j++){this[j].style.display="none";}
return this;}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";if(jQuery.isFunction(fn)&&jQuery.isFunction(fn2)){this._toggle.apply(this,arguments);}else if(fn==null||bool){this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]();});}else{this.animate(genFx("toggle",3),fn,fn2);}
return this;},fadeTo:function(speed,to,callback){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);if(jQuery.isEmptyObject(prop)){return this.each(optall.complete);}
return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType===1&&jQuery(this).is(":hidden"),self=this;for(p in prop){var name=p.replace(rdashAlpha,fcamelCase);if(p!==name){prop[name]=prop[p];delete prop[p];p=name;}
if(prop[p]==="hide"&&hidden||prop[p]==="show"&&!hidden){return opt.complete.call(this);}
if((p==="height"||p==="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}
if(jQuery.isArray(prop[p])){(opt.specialEasing=opt.specialEasing||{})[p]=prop[p][1];prop[p]=prop[p][0];}}
if(opt.overflow!=null){this.style.overflow="hidden";}
opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(rfxtypes.test(val)){e[val==="toggle"?hidden?"show":"hide":val](prop);}else{var parts=rfxnum.exec(val),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!=="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}
if(parts[1]){end=((parts[1]==="-="?-1:1)*end)+start;}
e.custom(start,end,unit);}else{e.custom(start,val,"");}}});return true;});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue){this.queue([]);}
this.each(function(){for(var i=timers.length-1;i>=0;i--){if(timers[i].elem===this){if(gotoEnd){timers[i](true);}
timers.splice(i,1);}}});if(!gotoEnd){this.dequeue();}
return this;}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback);};});jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false){jQuery(this).dequeue();}
if(jQuery.isFunction(opt.old)){opt.old.call(this);}};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig){options.orig={};}}});jQuery.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this);}
(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block";}},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop];}
var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd);}
t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(jQuery.fx.tick,13);}},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now(),done=true;if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var i in this.options.curAnim){if(this.options.curAnim[i]!==true){done=false;}}
if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var old=jQuery.data(this.elem,"olddisplay");this.elem.style.display=old?old:this.options.display;if(jQuery.css(this.elem,"display")==="none"){this.elem.style.display="block";}}
if(this.options.hide){jQuery(this.elem).hide();}
if(this.options.hide||this.options.show){for(var p in this.options.curAnim){jQuery.style(this.elem,p,this.options.orig[p]);}}
this.options.complete.call(this.elem);}
return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;var specialEasing=this.options.specialEasing&&this.options.specialEasing[this.prop];var defaultEasing=this.options.easing||(jQuery.easing.swing?"swing":"linear");this.pos=jQuery.easing[specialEasing||defaultEasing](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}
return true;}};jQuery.extend(jQuery.fx,{tick:function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++){if(!timers[i]()){timers.splice(i--,1);}}
if(!timers.length){jQuery.fx.stop();}},stop:function(){clearInterval(timerId);timerId=null;},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.style(fx.elem,"opacity",fx.now);},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null){fx.elem.style[fx.prop]=(fx.prop==="width"||fx.prop==="height"?Math.max(0,fx.now):fx.now)+fx.unit;}else{fx.elem[fx.prop]=fx.now;}}}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};}
function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type;});return obj;}
if("getBoundingClientRect"in document.documentElement){jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
var box=elem.getBoundingClientRect(),doc=elem.ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.support.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.support.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left};};}else{jQuery.fn.offset=function(options){var elem=this[0];if(options){return this.each(function(i){jQuery.offset.setOffset(this,options,i);});}
if(!elem||!elem.ownerDocument){return null;}
if(elem===elem.ownerDocument.body){return jQuery.offset.bodyOffset(elem);}
jQuery.offset.initialize();var offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle,top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){break;}
computedStyle=defaultView?defaultView.getComputedStyle(elem,null):elem.currentStyle;top-=elem.scrollTop;left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop;left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.nodeName))){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevOffsetParent=offsetParent,offsetParent=elem.offsetParent;}
if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible"){top+=parseFloat(computedStyle.borderTopWidth)||0;left+=parseFloat(computedStyle.borderLeftWidth)||0;}
prevComputedStyle=computedStyle;}
if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static"){top+=body.offsetTop;left+=body.offsetLeft;}
if(jQuery.offset.supportsFixedPosition&&prevComputedStyle.position==="fixed"){top+=Math.max(docElem.scrollTop,body.scrollTop);left+=Math.max(docElem.scrollLeft,body.scrollLeft);}
return{top:top,left:left};};}
jQuery.offset={initialize:function(){var body=document.body,container=document.createElement("div"),innerDiv,checkDiv,table,td,bodyMarginTop=parseFloat(jQuery.curCSS(body,"marginTop",true))||0,html="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";jQuery.extend(container.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild;checkDiv=innerDiv.firstChild;td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);checkDiv.style.position="fixed",checkDiv.style.top="20px";this.supportsFixedPosition=(checkDiv.offsetTop===20||checkDiv.offsetTop===15);checkDiv.style.position=checkDiv.style.top="";innerDiv.style.overflow="hidden",innerDiv.style.position="relative";this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(body.offsetTop!==bodyMarginTop);body.removeChild(container);body=container=innerDiv=checkDiv=table=td=null;jQuery.offset.initialize=jQuery.noop;},bodyOffset:function(body){var top=body.offsetTop,left=body.offsetLeft;jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){top+=parseFloat(jQuery.curCSS(body,"marginTop",true))||0;left+=parseFloat(jQuery.curCSS(body,"marginLeft",true))||0;}
return{top:top,left:left};},setOffset:function(elem,options,i){if(/static/.test(jQuery.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=jQuery(elem),curOffset=curElem.offset(),curTop=parseInt(jQuery.curCSS(elem,"top",true),10)||0,curLeft=parseInt(jQuery.curCSS(elem,"left",true),10)||0;if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}
var props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({position:function(){if(!this[0]){return null;}
var elem=this[0],offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].nodeName)?{top:0,left:0}:offsetParent.offset();offset.top-=parseFloat(jQuery.curCSS(elem,"marginTop",true))||0;offset.left-=parseFloat(jQuery.curCSS(elem,"marginLeft",true))||0;parentOffset.top+=parseFloat(jQuery.curCSS(offsetParent[0],"borderTopWidth",true))||0;parentOffset.left+=parseFloat(jQuery.curCSS(offsetParent[0],"borderLeftWidth",true))||0;return{top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};},offsetParent:function(){return this.map(function(){var offsetParent=this.offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.nodeName)&&jQuery.css(offsetParent,"position")==="static")){offsetParent=offsetParent.offsetParent;}
return offsetParent;});}});jQuery.each(["Left","Top"],function(i,name){var method="scroll"+name;jQuery.fn[method]=function(val){var elem=this[0],win;if(!elem){return null;}
if(val!==undefined){return this.each(function(){win=getWindow(this);if(win){win.scrollTo(!i?val:jQuery(win).scrollLeft(),i?val:jQuery(win).scrollTop());}else{this[method]=val;}});}else{win=getWindow(elem);return win?("pageXOffset"in win)?win[i?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&win.document.documentElement[method]||win.document.body[method]:elem[method];}};});function getWindow(elem){return("scrollTo"in elem&&elem.document)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}
jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],type,false,"padding"):null;};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],type,false,margin?"margin":"border"):null;};jQuery.fn[type]=function(size){var elem=this[0];if(!elem){return size==null?null:this;}
if(jQuery.isFunction(size)){return this.each(function(i){var self=jQuery(this);self[type](size.call(this,i,self[type]()));});}
return("scrollTo"in elem&&elem.document)?elem.document.compatMode==="CSS1Compat"&&elem.document.documentElement["client"+name]||elem.document.body["client"+name]:(elem.nodeType===9)?Math.max(elem.documentElement["client"+name],elem.body["scroll"+name],elem.documentElement["scroll"+name],elem.body["offset"+name],elem.documentElement["offset"+name]):size===undefined?jQuery.css(elem,type):this.css(type,typeof size==="string"?size:size+"px");};});window.jQuery=window.$=jQuery;})(window);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};(function(b){b.fn.extend({counter:function(a){a=b.extend({},{type:"char",count:"down",goal:1500},a);var d=false;return this.each(function(){function e(c){if(typeof a.type==="string")switch(a.type){case"char":if(a.count==="down"){g=" character(s) left";return a.goal-c}else if(a.count==="up"){g=" characters ("+a.goal+" max)";return c}break;case"word":if(a.count==="down"){g=" word(s) left";return a.goal-c}else if(a.count==="up"){g=" words ("+a.goal+" max)";return c}break;default:}}var g,f=b(this);b('<div id="'+this.id+'_counter" style="float:right; padding:0 20px; color:#666;"><span id="webCharsRemaining" style="color:#3E3596; font-family:Georgia,Times New Roman,Times,serif;">'+e(b(f).val().length)+'</span>'+g+'</div>').insertBefore(f);var i=b("#"+this.id+"_counter span");f.bind("keyup click blur focus change paste",function(c){switch(a.type){case"char":c=b(f).val().length;break;case"word":c=f.val()===""?0:b.trim(f.val()).replace(/\s+/g," ").split(" ").length;break;default:}switch(a.count){case"up":if(e(c)>=a.goal&&a.type==="char"){b(this).val(b(this).val().substring(0,a.goal));d=true;break}if(e(c)===a.goal&&a.type==="word"){d=true;break}else if(e(c)>a.goal&&a.type==="word"){b(this).val("");i.text("0");d=true;break}break;case"down":if(e(c)<=0&&a.type==="char"){b(this).val(b(this).val().substring(0,a.goal));d=true;break}if(e(c)===0&&a.type==="word")d=true;else if(e(c)<0&&a.type==="word"){b(this).val("");d=true;break}break;default:}f.keydown(function(h){if(d){this.focus();if(h.keyCode!==46&&h.keyCode!==8)if(b(this).val().length>a.goal&&a.type==="char"){b(this).val(b(this).val().substring(0,a.goal));return false}else return h.keyCode!==32&&h.keyCode!==8&&a.type==="word"?true:false;else{d=false;return true}}});i.text(e(c))})})}})})(jQuery);(function($){$.fn.jOdometer=function(settings){settings=$.extend({},$.fn.jOdometer.defaults,settings);return this.each(function(){var scope=$(this);var zeroSet=-settings.heightNumber;var counter=parseFloat(settings.counterStart);var integersArray=[];var decimalsArray=[];var digits=String(settings.counterStart).split('.');var numberOfDecimals=0;var widthDot=0;if(digits[1]){var j=0;for(var i=digits[1].length-1;i>-1;i--){decimalsArray[i]=digits[1].charAt(i);$(this).append('<img style="position:absolute; right:'+(j*settings.widthNumber+settings.offsetRight+j*settings.spaceNumbers)+'px; top:'+((parseInt(decimalsArray[i])*settings.heightNumber*-1)+zeroSet)+'px;" class="jodometer_decimal_'+i+'" src="'+settings.numbersImage+'" alt="Decimal '+(i+1)+'" />');j++;}
$(this).append('<div style="position:absolute; width:'+settings.widthDot+'px; height:'+settings.heightNumber+'px; background:url('+settings.numbersImage+') no-repeat center bottom; right:'+(digits[1].length*settings.widthNumber+settings.offsetRight+digits[1].length*settings.spaceNumbers)+'px;" class="jodometer_dot"></div>');numberOfDecimals=digits[1].length;widthDot=settings.widthDot;}
var integers=digits[0];var j=integers.length-1;for(var i=0;i<integers.length;i++){integersArray[i]=integers.charAt(j);$(this).append('<img style="position:absolute; right:'+(i*settings.widthNumber+numberOfDecimals*settings.widthNumber+widthDot+settings.offsetRight+numberOfDecimals*settings.spaceNumbers+i*settings.spaceNumbers+settings.spaceNumbers)+'px; top:'+((parseInt(integersArray[i])*settings.heightNumber*-1)+zeroSet)+'px;" class="jodometer_integer_'+i+'" src="'+settings.numbersImage+'" alt="Integer '+(i+1)+'" />');j--;}
if(parseFloat(settings.counterStart)!=settings.counterEnd||(settings.counterEnd.toString()=='false'&&parseFloat(settings.counterStart)==0)){advanceCounter();}
function advanceCounter(){setNumbers(counter);counter=counter+settings.increment;if(settings.counterEnd!=false&&counter>=settings.counterEnd){setNumbers(settings.counterEnd);}}
function setNumbers(counter){digits=String(counter).split('.');if(decimalsArray.length>0){for(i=0;i<decimalsArray.length;i++){oldDigit=decimalsArray[i];if(digits[1]){decimalsArray[i]=digits[1].charAt(i);}
if(decimalsArray[i]==''){decimalsArray[i]='0';}
updatePosition($('.jodometer_decimal_'+i,scope),parseInt(decimalsArray[i]),parseInt(oldDigit));}}
integers=digits[0];j=integers.length-1;for(i=0;i<integersArray.length;i++){oldDigit=integersArray[i];integersArray[i]=integers.charAt(j);if(integersArray[i]==''){integersArray[i]='0';}
updatePosition($('.jodometer_integer_'+i,scope),parseInt(integersArray[i]),parseInt(oldDigit));j--;}}
function updatePosition(col,newDigit,oldDigit){if(newDigit!=oldDigit){col.stop();if(newDigit==0){col.animate({top:(10*settings.heightNumber*-1)+zeroSet},settings.speed,settings.easing).animate({top:zeroSet},1,'linear');}else{if(newDigit<oldDigit){col.animate({top:(10*settings.heightNumber*-1)+zeroSet},settings.speed*((10-oldDigit)/10),'linear').animate({top:zeroSet},1,'linear').animate({top:(newDigit*settings.heightNumber*-1)+zeroSet},settings.speed*oldDigit/10,settings.easing);}else{col.animate({top:(newDigit*settings.heightNumber*-1)+zeroSet},settings.speed,settings.easing);}}}}});};$.fn.jOdometer.defaults={counterStart:'0000.00',counterEnd:false,delayTime:1000,increment:0.01,speed:500,easing:'swing',heightNumber:31,widthNumber:19,offsetRight:8,spaceNumbers:6,widthDot:5};})(jQuery);(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);jQuery.fn.supersleight=function(settings){settings=jQuery.extend({imgs:true,backgrounds:true,shim:'x.gif',apply_positioning:true},settings);return this.each(function(){if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7&&parseInt(jQuery.browser.version,10)>4){jQuery(this).find('*').andSelf().each(function(i,obj){var self=jQuery(obj);if(settings.backgrounds&&self.css('background-image').match(/\.png/i)!==null){var bg=self.css('background-image');var src=bg.substring(5,bg.length-2);var mode=(self.css('background-repeat')=='no-repeat'?'crop':'scale');var styles={'filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='"+mode+"')",'background-image':'url('+settings.shim+')'};self.css(styles);};if(settings.imgs&&self.is('img[src$=png]')){var styles={'width':self.width()+'px','height':self.height()+'px','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+self.attr('src')+"', sizingMethod='scale')"};self.css(styles).attr('src',settings.shim);};if(settings.apply_positioning&&self.is('a, input')&&(self.css('position')===''||self.css('position')=='static')){self.css('position','relative');};});};});};(function($,flash){var createAttrs=function(obj){var aEach,aArray=[];for(aEach in obj){if(/string|number/.test(typeof obj[aEach])&&obj[aEach]!==''){aArray.push(aEach+'="'+obj[aEach]+'"');}}
return aArray[j]('');},createParams=function(obj){var aEach,bEach,aArray=[],bArray;if(typeof obj=='object'){for(aEach in obj){if(typeof obj[aEach]=='object'){bArray=[];for(bEach in obj[aEach]){bArray.push([bEach,'=',encodeURIComponent(obj[aEach][bEach])][j](''));}
obj[aEach]=bArray[j]('&amp;');}
if(obj[aEach]){aArray.push(['<param name="',aEach,'" value="',obj[aEach],'" />'][j](''));}}
obj=aArray[j]('');}
return obj;},expressInstallIsActive=false,j='join';$[flash]=(function(){try{var flashVersion='0,0,0',Plugin=navigator.plugins['Shockwave Flash']||ActiveXObject;flashVersion=Plugin.description||(function(){try{return(new Plugin('ShockwaveFlash.ShockwaveFlash')).GetVariable('$version');}
catch(eIE){}}());}
catch(e){}
if(flashVersion==null){flashVersion="WIN 0,0,32,0,0,32";}
flashVersion=flashVersion.match(/^[A-Za-z\s]*?(\d+)[\.|,](\d+)(?:\s+[d|r]|,)(\d+)/);return{available:flashVersion[1]>0,activeX:Plugin&&!Plugin.name,version:{major:flashVersion[1]*1,minor:flashVersion[2]*1,release:flashVersion[3]*1},hasVersion:function(version){var versionCompare=this.version,major='major',minor='minor',release='release';version=(/string|number/.test(typeof version))?version.toString().split('.'):version||[0,0,0];version=[version[major]||version[0]||versionCompare[major],version[minor]||version[1]||versionCompare[minor],version[release]||version[2]||versionCompare[release]];return(version[0]<versionCompare[major])||(version[0]==versionCompare[major]&&version[1]<versionCompare[minor])||(version[0]==versionCompare[major]&&version[1]==versionCompare[minor]&&version[2]<=versionCompare[release]);},expressInstall:'expressInstall.swf',create:function(obj){if(!$[flash].available||expressInstallIsActive||!typeof obj=='object'||!obj.swf){return false;}
if(obj.hasVersion&&!$[flash].hasVersion(obj.hasVersion)){obj={swf:obj.expressInstall||$[flash].expressInstall,attrs:{id:obj.id||'SWFObjectExprInst',name:obj.name,height:Math.max(obj.height||137),width:Math.max(obj.width||214)},params:{flashvars:{MMredirectURL:location.href,MMplayerType:($[flash].activeX)?'ActiveX':'PlugIn',MMdoctitle:document.title.slice(0,47)+' - Flash Player Installation'}}};expressInstallIsActive=true;}
else{obj=$.extend(true,{attrs:{id:obj.id,name:obj.name,height:obj.height||180,width:obj.width||320},params:{wmode:obj.wmode||'opaque',flashvars:obj.flashvars}},obj);}
if($[flash].activeX){obj.attrs.classid=obj.attrs.classid||'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';obj.params.movie=obj.params.movie||obj.swf;}
else{obj.attrs.type=obj.attrs.classid||'application/x-shockwave-flash';obj.attrs.data=obj.attrs.data||obj.swf;}
return['<object ',createAttrs(obj.attrs),'>',createParams(obj.params),'</object>'][j]('');}};}());$.fn[flash]=function(args){if(typeof args=='object'){this.each(function(){var test=document.createElement(flash);var newFlash=$[flash].create(args);if(newFlash){test.innerHTML=newFlash;if(test.childNodes[0]){this.appendChild(test.childNodes[0]);}};});}
else if(typeof args=='function'){this.find('object').andSelf().filter('object').each(function(){var elem=this,jsInteractionTimeoutMs='jsInteractionTimeoutMs';elem[jsInteractionTimeoutMs]=elem[jsInteractionTimeoutMs]||0;if(elem[jsInteractionTimeoutMs]<660){if(elem.clientWidth||elem.clientHeight){args.call(this);}
else{setTimeout(function(){$(elem)[flash](args);},elem[jsInteractionTimeoutMs]+66);}}});}
return this;};}(jQuery,'flash'));(function($){$.ui=$.ui||{};if($.ui.version){return;}
$.extend($.ui,{version:"1.8.2",plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]]);}},call:function(instance,name,args){var set=instance.plugins[name];if(!set||!instance.element[0].parentNode){return;}
for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args);}}}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b);},hasScroll:function(el,a){if($(el).css('overflow')=='hidden'){return false;}
var scroll=(a&&a=='left')?'scrollLeft':'scrollTop',has=false;if(el[scroll]>0){return true;}
el[scroll]=1;has=(el[scroll]>0);el[scroll]=0;return has;},isOverAxis:function(x,reference,size){return(x>reference)&&(x<(reference+size));},isOver:function(y,x,top,left,height,width){return $.ui.isOverAxis(y,top,height)&&$.ui.isOverAxis(x,left,width);},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});$.fn.extend({_focus:$.fn.focus,focus:function(delay,fn){return typeof delay==='number'?this.each(function(){var elem=this;setTimeout(function(){$(elem).focus();(fn&&fn.call(elem));},delay);}):this._focus.apply(this,arguments);},enableSelection:function(){return this.attr('unselectable','off').css('MozUserSelect','');},disableSelection:function(){return this.attr('unselectable','on').css('MozUserSelect','none');},scrollParent:function(){var scrollParent;if(($.browser.msie&&(/(static|relative)/).test(this.css('position')))||(/absolute/).test(this.css('position'))){scrollParent=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test($.curCSS(this,'position',1))&&(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}else{scrollParent=this.parents().filter(function(){return(/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));}).eq(0);}
return(/fixed/).test(this.css('position'))||!scrollParent.length?$(document):scrollParent;},zIndex:function(zIndex){if(zIndex!==undefined){return this.css('zIndex',zIndex);}
if(this.length){var elem=$(this[0]),position,value;while(elem.length&&elem[0]!==document){position=elem.css('position');if(position=='absolute'||position=='relative'||position=='fixed')
{value=parseInt(elem.css('zIndex'));if(!isNaN(value)&&value!=0){return value;}}
elem=elem.parent();}}
return 0;}});$.extend($.expr[':'],{data:function(elem,i,match){return!!$.data(elem,match[3]);},focusable:function(element){var nodeName=element.nodeName.toLowerCase(),tabIndex=$.attr(element,'tabindex');return(/input|select|textarea|button|object/.test(nodeName)?!element.disabled:'a'==nodeName||'area'==nodeName?element.href||!isNaN(tabIndex):!isNaN(tabIndex))&&!$(element)['area'==nodeName?'parents':'closest'](':hidden').length;},tabbable:function(element){var tabIndex=$.attr(element,'tabindex');return(isNaN(tabIndex)||tabIndex>=0)&&$(element).is(':focusable');}});})(jQuery);(function($){var _remove=$.fn.remove;$.fn.remove=function(selector,keepData){return this.each(function(){if(!keepData){if(!selector||$.filter(selector,[this]).length){$("*",this).add(this).each(function(){$(this).triggerHandler("remove");});}}
return _remove.call($(this),selector,keepData);});};$.widget=function(name,base,prototype){var namespace=name.split(".")[0],fullName;name=name.split(".")[1];fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget;}
$.expr[":"][fullName]=function(elem){return!!$.data(elem,name);};$[namespace]=$[namespace]||{};$[namespace][name]=function(options,element){if(arguments.length){this._createWidget(options,element);}};var basePrototype=new base();basePrototype.options=$.extend({},basePrototype.options);$[namespace][name].prototype=$.extend(true,basePrototype,{namespace:namespace,widgetName:name,widgetEventPrefix:$[namespace][name].prototype.widgetEventPrefix||name,widgetBaseClass:fullName},prototype);$.widget.bridge(name,$[namespace][name]);};$.widget.bridge=function(name,object){$.fn[name]=function(options){var isMethodCall=typeof options==="string",args=Array.prototype.slice.call(arguments,1),returnValue=this;options=!isMethodCall&&args.length?$.extend.apply(null,[true,options].concat(args)):options;if(isMethodCall&&options.substring(0,1)==="_"){return returnValue;}
if(isMethodCall){this.each(function(){var instance=$.data(this,name),methodValue=instance&&$.isFunction(instance[options])?instance[options].apply(instance,args):instance;if(methodValue!==instance&&methodValue!==undefined){returnValue=methodValue;return false;}});}else{this.each(function(){var instance=$.data(this,name);if(instance){if(options){instance.option(options);}
instance._init();}else{$.data(this,name,new object(options,this));}});}
return returnValue;};};$.Widget=function(options,element){if(arguments.length){this._createWidget(options,element);}};$.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(options,element){this.element=$(element).data(this.widgetName,this);this.options=$.extend(true,{},this.options,$.metadata&&$.metadata.get(element)[this.widgetName],options);var self=this;this.element.bind("remove."+this.widgetName,function(){self.destroy();});this._create();this._init();},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled");},widget:function(){return this.element;},option:function(key,value){var options=key,self=this;if(arguments.length===0){return $.extend({},self.options);}
if(typeof key==="string"){if(value===undefined){return this.options[key];}
options={};options[key]=value;}
$.each(options,function(key,value){self._setOption(key,value);});return self;},_setOption:function(key,value){this.options[key]=value;if(key==="disabled"){this.widget()
[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",value);}
return this;},enable:function(){return this._setOption("disabled",false);},disable:function(){return this._setOption("disabled",true);},_trigger:function(type,event,data){var callback=this.options[type];event=$.Event(event);event.type=(type===this.widgetEventPrefix?type:this.widgetEventPrefix+type).toLowerCase();data=data||{};if(event.originalEvent){for(var i=$.event.props.length,prop;i;){prop=$.event.props[--i];event[prop]=event.originalEvent[prop];}}
this.element.trigger(event,data);return!($.isFunction(callback)&&callback.call(this.element[0],event,data)===false||event.isDefaultPrevented());}};})(jQuery);(function($){$.widget("ui.autocomplete",{options:{minLength:1,delay:300},_create:function(){var self=this,doc=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(event){var keyCode=$.ui.keyCode;switch(event.keyCode){case keyCode.PAGE_UP:self._move("previousPage",event);break;case keyCode.PAGE_DOWN:self._move("nextPage",event);break;case keyCode.UP:self._move("previous",event);event.preventDefault();break;case keyCode.DOWN:self._move("next",event);event.preventDefault();break;case keyCode.ENTER:case keyCode.NUMPAD_ENTER:if(self.menu.active){event.preventDefault();}
case keyCode.TAB:if(!self.menu.active){return;}
self.menu.select(event);break;case keyCode.ESCAPE:self.element.val(self.term);self.close(event);break;case keyCode.LEFT:case keyCode.RIGHT:case keyCode.SHIFT:case keyCode.CONTROL:case keyCode.ALT:case keyCode.COMMAND:case keyCode.COMMAND_RIGHT:case keyCode.INSERT:case keyCode.CAPS_LOCK:case keyCode.END:case keyCode.HOME:break;default:clearTimeout(self.searching);self.searching=setTimeout(function(){self.search(null,event);},self.options.delay);break;}}).bind("focus.autocomplete",function(){self.selectedItem=null;self.previous=self.element.val();}).bind("blur.autocomplete",function(event){clearTimeout(self.searching);self.closing=setTimeout(function(){self.close(event);self._change(event);},150);});this._initSource();this.response=function(){return self._response.apply(self,arguments);};this.menu=$("<ul></ul>").addClass("ui-autocomplete").appendTo("body",doc).mousedown(function(){setTimeout(function(){clearTimeout(self.closing);},13);}).menu({focus:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("focus",null,{item:item})){if(/^key/.test(event.originalEvent.type)){self.element.val(item.value);}}},selected:function(event,ui){var item=ui.item.data("item.autocomplete");if(false!==self._trigger("select",event,{item:item})){self.element.val(item.value);}
self.close(event);var previous=self.previous;if(self.element[0]!==doc.activeElement){self.element.focus();self.previous=previous;}
self.selectedItem=item;},blur:function(event,ui){if(self.menu.element.is(":visible")){self.element.val(self.term);}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if($.fn.bgiframe){this.menu.element.bgiframe();}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();$.Widget.prototype.destroy.call(this);},_setOption:function(key){$.Widget.prototype._setOption.apply(this,arguments);if(key==="source"){this._initSource();}},_initSource:function(){var array,url;if($.isArray(this.options.source)){array=this.options.source;this.source=function(request,response){response($.ui.autocomplete.filter(array,request.term));};}else if(typeof this.options.source==="string"){url=this.options.source;this.source=function(request,response){$.getJSON(url,request,response);};}else{this.source=this.options.source;}},search:function(value,event){value=value!=null?value:this.element.val();if(value.length<this.options.minLength){return this.close(event);}
clearTimeout(this.closing);if(this._trigger("search")===false){return;}
return this._search(value);},_search:function(value){this.term=this.element.addClass("ui-autocomplete-loading").val();this.source({term:value},this.response);},_response:function(content){if(content.length){content=this._normalize(content);this._suggest(content);this._trigger("open");}else{this.close();}
this.element.removeClass("ui-autocomplete-loading");},close:function(event){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this._trigger("close",event);this.menu.element.hide();this.menu.deactivate();}},_change:function(event){if(this.previous!==this.element.val()){this._trigger("change",event,{item:this.selectedItem});}},_normalize:function(items){if(items.length&&items[0].label&&items[0].value){return items;}
return $.map(items,function(item){if(typeof item==="string"){return{label:item,value:item};}
return $.extend({label:item.label||item.value,value:item.value||item.label},item);});},_suggest:function(items){var ul=this.menu.element.empty().zIndex(this.element.zIndex()+1),menuWidth,textWidth;this._renderMenu(ul,items);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position({my:"left top",at:"left bottom",of:this.element,collision:"none"});menuWidth=ul.width("").width();textWidth=this.element.width();ul.width(Math.max(menuWidth,textWidth));},_renderMenu:function(ul,items){var self=this;$.each(items,function(index,item){self._renderItem(ul,item);});},_renderItem:function(ul,item){return $("<li></li>").data("item.autocomplete",item).append("<a>"+item.label+"</a>").appendTo(ul);},_move:function(direction,event){if(!this.menu.element.is(":visible")){this.search(null,event);return;}
if(this.menu.first()&&/^previous/.test(direction)||this.menu.last()&&/^next/.test(direction)){this.element.val(this.term);this.menu.deactivate();return;}
this.menu[direction](event);},widget:function(){return this.menu.element;}});$.extend($.ui.autocomplete,{escapeRegex:function(value){return value.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1");},filter:function(array,term){var matcher=new RegExp($.ui.autocomplete.escapeRegex(term),"i");return $.grep(array,function(value){return matcher.test(value.label||value.value||value);});}});}(jQuery));(function($){$.widget("ui.menu",{_create:function(){var self=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(event){if(!$(event.target).closest(".ui-menu-item a").length){return;}
event.preventDefault();self.select(event);});this.refresh();},refresh:function(){var self=this;var items=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");items.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(event){self.activate(event,$(this).parent());}).mouseleave(function(){self.deactivate();});},activate:function(event,item){this.deactivate();if(this.hasScroll()){var offset=item.offset().top-this.element.offset().top,scroll=this.element.attr("scrollTop"),elementHeight=this.element.height();if(offset<0){this.element.attr("scrollTop",scroll+offset);}else if(offset>elementHeight){this.element.attr("scrollTop",scroll+offset-elementHeight+item.height());}}
this.active=item.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",event,{item:item});},deactivate:function(){if(!this.active){return;}
this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null;},next:function(event){this.move("next",".ui-menu-item:first",event);},previous:function(event){this.move("prev",".ui-menu-item:last",event);},first:function(){return this.active&&!this.active.prev().length;},last:function(){return this.active&&!this.active.next().length;},move:function(direction,edge,event){if(!this.active){this.activate(event,this.element.children(edge));return;}
var next=this.active[direction+"All"](".ui-menu-item").eq(0);if(next.length){this.activate(event,next);}else{this.activate(event,this.element.children(edge));}},nextPage:function(event){if(this.hasScroll()){if(!this.active||this.last()){this.activate(event,this.element.children(":first"));return;}
var base=this.active.offset().top,height=this.element.height(),result=this.element.children("li").filter(function(){var close=$(this).offset().top-base-height+$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(":last");}
this.activate(event,result);}else{this.activate(event,this.element.children(!this.active||this.last()?":first":":last"));}},previousPage:function(event){if(this.hasScroll()){if(!this.active||this.first()){this.activate(event,this.element.children(":last"));return;}
var base=this.active.offset().top,height=this.element.height();result=this.element.children("li").filter(function(){var close=$(this).offset().top-base+height-$(this).height();return close<10&&close>-10;});if(!result.length){result=this.element.children(":first");}
this.activate(event,result);}else{this.activate(event,this.element.children(!this.active||this.first()?":last":":first"));}},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight");},select:function(event){this._trigger("selected",event,{item:this.active});}});}(jQuery));(function($){var uiDialogClasses='ui-dialog '+'ui-widget '+'ui-widget-content '+'ui-corner-all ';$.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:'close',dialogClass:'',draggable:true,hide:null,height:'auto',maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:'center',resizable:true,show:null,stack:true,title:'',width:300,zIndex:1000},_create:function(){this.originalTitle=this.element.attr('title');var self=this,options=self.options,title=options.title||self.originalTitle||'&#160;',titleId=$.ui.dialog.getTitleId(self.element),uiDialog=(self.uiDialog=$('<div></div>')).appendTo(document.body).hide().addClass(uiDialogClasses+options.dialogClass).css({zIndex:options.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(event){if(options.closeOnEscape&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){self.close(event);event.preventDefault();}}).attr({role:'dialog','aria-labelledby':titleId}).mousedown(function(event){self.moveToTop(false,event);}),uiDialogContent=self.element.show().removeAttr('title').addClass('ui-dialog-content '+'ui-widget-content').appendTo(uiDialog),uiDialogTitlebar=(self.uiDialogTitlebar=$('<div></div>')).addClass('ui-dialog-titlebar '+'ui-widget-header '+'ui-corner-all '+'ui-helper-clearfix').prependTo(uiDialog),uiDialogTitlebarClose=$('<a href="#"></a>').addClass('ui-dialog-titlebar-close '+'ui-corner-all').attr('role','button').hover(function(){uiDialogTitlebarClose.addClass('ui-state-hover');},function(){uiDialogTitlebarClose.removeClass('ui-state-hover');}).focus(function(){uiDialogTitlebarClose.addClass('ui-state-focus');}).blur(function(){uiDialogTitlebarClose.removeClass('ui-state-focus');}).click(function(event){self.close(event);return false;}).appendTo(uiDialogTitlebar),uiDialogTitlebarCloseText=(self.uiDialogTitlebarCloseText=$('<span></span>')).addClass('ui-icon '+'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose),uiDialogTitle=$('<span></span>').addClass('ui-dialog-title').attr('id',titleId).html(title).prependTo(uiDialogTitlebar);if($.isFunction(options.beforeclose)&&!$.isFunction(options.beforeClose)){options.beforeClose=options.beforeclose;}
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();if(options.draggable&&$.fn.draggable){self._makeDraggable();}
if(options.resizable&&$.fn.resizable){self._makeResizable();}
self._createButtons(options.buttons);self._isOpen=false;if($.fn.bgiframe){uiDialog.bgiframe();}},_init:function(){if(this.options.autoOpen){this.open();}},destroy:function(){var self=this;if(self.overlay){self.overlay.destroy();}
self.uiDialog.hide();self.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body');self.uiDialog.remove();if(self.originalTitle){self.element.attr('title',self.originalTitle);}
return self;},widget:function(){return this.uiDialog;},close:function(event){var self=this,maxZ;if(false===self._trigger('beforeClose',event)){return;}
if(self.overlay){self.overlay.destroy();}
self.uiDialog.unbind('keypress.ui-dialog');self._isOpen=false;if(self.options.hide){self.uiDialog.hide(self.options.hide,function(){self._trigger('close',event);});}else{self.uiDialog.hide();self._trigger('close',event);}
$.ui.dialog.overlay.resize();if(self.options.modal){maxZ=0;$('.ui-dialog').each(function(){if(this!==self.uiDialog[0]){maxZ=Math.max(maxZ,$(this).css('z-index'));}});$.ui.dialog.maxZ=maxZ;}
return self;},isOpen:function(){return this._isOpen;},moveToTop:function(force,event){var self=this,options=self.options,saveScroll;if((options.modal&&!force)||(!options.stack&&!options.modal)){return self._trigger('focus',event);}
if(options.zIndex>$.ui.dialog.maxZ){$.ui.dialog.maxZ=options.zIndex;}
if(self.overlay){$.ui.dialog.maxZ+=1;self.overlay.$el.css('z-index',$.ui.dialog.overlay.maxZ=$.ui.dialog.maxZ);}
saveScroll={scrollTop:self.element.attr('scrollTop'),scrollLeft:self.element.attr('scrollLeft')};$.ui.dialog.maxZ+=1;self.uiDialog.css('z-index',$.ui.dialog.maxZ);self.element.attr(saveScroll);self._trigger('focus',event);return self;},open:function(){if(this._isOpen){return;}
var self=this,options=self.options,uiDialog=self.uiDialog;self.overlay=options.modal?new $.ui.dialog.overlay(self):null;if(uiDialog.next().length){uiDialog.appendTo('body');}
self._size();self._position(options.position);uiDialog.show(options.show);self.moveToTop(true);if(options.modal){uiDialog.bind('keypress.ui-dialog',function(event){if(event.keyCode!==$.ui.keyCode.TAB){return;}
var tabbables=$(':tabbable',this),first=tabbables.filter(':first'),last=tabbables.filter(':last');if(event.target===last[0]&&!event.shiftKey){first.focus(1);return false;}else if(event.target===first[0]&&event.shiftKey){last.focus(1);return false;}});}
$([]).add(uiDialog.find('.ui-dialog-content :tabbable:first')).add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')).add(uiDialog).filter(':first').focus();self._trigger('open');self._isOpen=true;return self;},_createButtons:function(buttons){var self=this,hasButtons=false,uiDialogButtonPane=$('<div></div>').addClass('ui-dialog-buttonpane '+'ui-widget-content '+'ui-helper-clearfix');self.uiDialog.find('.ui-dialog-buttonpane').remove();if(typeof buttons==='object'&&buttons!==null){$.each(buttons,function(){return!(hasButtons=true);});}
if(hasButtons){$.each(buttons,function(name,fn){var button=$('<button type="button"></button>').text(name).click(function(){fn.apply(self.element[0],arguments);}).appendTo(uiDialogButtonPane);if($.fn.button){button.button();}});uiDialogButtonPane.appendTo(self.uiDialog);}},_makeDraggable:function(){var self=this,options=self.options,doc=$(document),heightBeforeDrag;function filteredUi(ui){return{position:ui.position,offset:ui.offset};}
self.uiDialog.draggable({cancel:'.ui-dialog-content, .ui-dialog-titlebar-close',handle:'.ui-dialog-titlebar',containment:'document',start:function(event,ui){heightBeforeDrag=options.height==="auto"?"auto":$(this).height();$(this).height($(this).height()).addClass("ui-dialog-dragging");self._trigger('dragStart',event,filteredUi(ui));},drag:function(event,ui){self._trigger('drag',event,filteredUi(ui));},stop:function(event,ui){options.position=[ui.position.left-doc.scrollLeft(),ui.position.top-doc.scrollTop()];$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);self._trigger('dragStop',event,filteredUi(ui));$.ui.dialog.overlay.resize();}});},_makeResizable:function(handles){handles=(handles===undefined?this.options.resizable:handles);var self=this,options=self.options,position=self.uiDialog.css('position'),resizeHandles=(typeof handles==='string'?handles:'n,e,s,w,se,sw,ne,nw');function filteredUi(ui){return{originalPosition:ui.originalPosition,originalSize:ui.originalSize,position:ui.position,size:ui.size};}
self.uiDialog.resizable({cancel:'.ui-dialog-content',containment:'document',alsoResize:self.element,maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:self._minHeight(),handles:resizeHandles,start:function(event,ui){$(this).addClass("ui-dialog-resizing");self._trigger('resizeStart',event,filteredUi(ui));},resize:function(event,ui){self._trigger('resize',event,filteredUi(ui));},stop:function(event,ui){$(this).removeClass("ui-dialog-resizing");options.height=$(this).height();options.width=$(this).width();self._trigger('resizeStop',event,filteredUi(ui));$.ui.dialog.overlay.resize();}}).css('position',position).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');},_minHeight:function(){var options=this.options;if(options.height==='auto'){return options.minHeight;}else{return Math.min(options.minHeight,options.height);}},_position:function(position){var myAt=[],offset=[0,0],isVisible;position=position||$.ui.dialog.prototype.options.position;if(typeof position==='string'||(typeof position==='object'&&'0'in position)){myAt=position.split?position.split(' '):[position[0],position[1]];if(myAt.length===1){myAt[1]=myAt[0];}
$.each(['left','top'],function(i,offsetPosition){if(+myAt[i]===myAt[i]){offset[i]=myAt[i];myAt[i]=offsetPosition;}});}else if(typeof position==='object'){if('left'in position){myAt[0]='left';offset[0]=position.left;}else if('right'in position){myAt[0]='right';offset[0]=-position.right;}
if('top'in position){myAt[1]='top';offset[1]=position.top;}else if('bottom'in position){myAt[1]='bottom';offset[1]=-position.bottom;}}
isVisible=this.uiDialog.is(':visible');if(!isVisible){this.uiDialog.show();}
this.uiDialog.css({top:0,left:0}).position({my:myAt.join(' '),at:myAt.join(' '),offset:offset.join(' '),of:window,collision:'fit',using:function(pos){var topOffset=$(this).css(pos).offset().top;if(topOffset<0){$(this).css('top',pos.top-topOffset);}}});if(!isVisible){this.uiDialog.hide();}},_setOption:function(key,value){var self=this,uiDialog=self.uiDialog,isResizable=uiDialog.is(':data(resizable)'),resize=false;switch(key){case"beforeclose":key="beforeClose";break;case"buttons":self._createButtons(value);break;case"closeText":self.uiDialogTitlebarCloseText.text(""+value);break;case"dialogClass":uiDialog.removeClass(self.options.dialogClass).addClass(uiDialogClasses+value);break;case"disabled":if(value){uiDialog.addClass('ui-dialog-disabled');}else{uiDialog.removeClass('ui-dialog-disabled');}
break;case"draggable":if(value){self._makeDraggable();}else{uiDialog.draggable('destroy');}
break;case"height":resize=true;break;case"maxHeight":if(isResizable){uiDialog.resizable('option','maxHeight',value);}
resize=true;break;case"maxWidth":if(isResizable){uiDialog.resizable('option','maxWidth',value);}
resize=true;break;case"minHeight":if(isResizable){uiDialog.resizable('option','minHeight',value);}
resize=true;break;case"minWidth":if(isResizable){uiDialog.resizable('option','minWidth',value);}
resize=true;break;case"position":self._position(value);break;case"resizable":if(isResizable&&!value){uiDialog.resizable('destroy');}
if(isResizable&&typeof value==='string'){uiDialog.resizable('option','handles',value);}
if(!isResizable&&value!==false){self._makeResizable(value);}
break;case"title":$(".ui-dialog-title",self.uiDialogTitlebar).html(""+(value||'&#160;'));break;case"width":resize=true;break;}
$.Widget.prototype._setOption.apply(self,arguments);if(resize){self._size();}},_size:function(){var options=this.options,nonContentHeight;this.element.css({width:'auto',minHeight:0,height:0});nonContentHeight=this.uiDialog.css({height:'auto',width:options.width}).height();this.element.css(options.height==='auto'?{minHeight:Math.max(options.minHeight-nonContentHeight,0),height:'auto'}:{minHeight:0,height:Math.max(options.height-nonContentHeight,0)}).show();if(this.uiDialog.is(':data(resizable)')){this.uiDialog.resizable('option','minHeight',this._minHeight());}}});$.extend($.ui.dialog,{version:"1.8.2",uuid:0,maxZ:0,getTitleId:function($el){var id=$el.attr('id');if(!id){this.uuid+=1;id=this.uuid;}
return'ui-dialog-title-'+id;},overlay:function(dialog){this.$el=$.ui.dialog.overlay.create(dialog);}});$.extend($.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:$.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(event){return event+'.dialog-overlay';}).join(' '),create:function(dialog){if(this.instances.length===0){setTimeout(function(){if($.ui.dialog.overlay.instances.length){$(document).bind($.ui.dialog.overlay.events,function(event){return($(event.target).zIndex()>=$.ui.dialog.overlay.maxZ);});}},1);$(document).bind('keydown.dialog-overlay',function(event){if(dialog.options.closeOnEscape&&event.keyCode&&event.keyCode===$.ui.keyCode.ESCAPE){dialog.close(event);event.preventDefault();}});$(window).bind('resize.dialog-overlay',$.ui.dialog.overlay.resize);}
var $el=(this.oldInstances.pop()||$('<div></div>').addClass('ui-widget-overlay')).appendTo(document.body).css({width:this.width(),height:this.height()});if($.fn.bgiframe){$el.bgiframe();}
this.instances.push($el);return $el;},destroy:function($el){this.oldInstances.push(this.instances.splice($.inArray($el,this.instances),1)[0]);if(this.instances.length===0){$([document,window]).unbind('.dialog-overlay');}
$el.remove();var maxZ=0;$.each(this.instances,function(){maxZ=Math.max(maxZ,this.css('z-index'));});this.maxZ=maxZ;},height:function(){var scrollHeight,offsetHeight;if($.browser.msie&&$.browser.version<7){scrollHeight=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);offsetHeight=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(scrollHeight<offsetHeight){return $(window).height()+'px';}else{return scrollHeight+'px';}}else{return $(document).height()+'px';}},width:function(){var scrollWidth,offsetWidth;if($.browser.msie&&$.browser.version<7){scrollWidth=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);offsetWidth=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(scrollWidth<offsetWidth){return $(window).width()+'px';}else{return scrollWidth+'px';}}else{return $(document).width()+'px';}},resize:function(){var $overlays=$([]);$.each($.ui.dialog.overlay.instances,function(){$overlays=$overlays.add(this);});$overlays.css({width:0,height:0}).css({width:$.ui.dialog.overlay.width(),height:$.ui.dialog.overlay.height()});}});$.extend($.ui.dialog.overlay.prototype,{destroy:function(){$.ui.dialog.overlay.destroy(this.$el);}});}(jQuery));(function($){$.widget("ui.mouse",{options:{cancel:':input,option',distance:1,delay:0},_mouseInit:function(){var self=this;this.element.bind('mousedown.'+this.widgetName,function(event){return self._mouseDown(event);}).bind('click.'+this.widgetName,function(event){if(self._preventClickEvent){self._preventClickEvent=false;event.stopImmediatePropagation();return false;}});this.started=false;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);},_mouseDown:function(event){event.originalEvent=event.originalEvent||{};if(event.originalEvent.mouseHandled){return;}
(this._mouseStarted&&this._mouseUp(event));this._mouseDownEvent=event;var self=this,btnIsLeft=(event.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(event.target).parents().add(event.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this._mouseCapture(event)){return true;}
this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self.mouseDelayMet=true;},this.options.delay);}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(event)!==false);if(!this._mouseStarted){event.preventDefault();return true;}}
this._mouseMoveDelegate=function(event){return self._mouseMove(event);};this._mouseUpDelegate=function(event){return self._mouseUp(event);};$(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate);($.browser.safari||event.preventDefault());event.originalEvent.mouseHandled=true;return true;},_mouseMove:function(event){if($.browser.msie&&!event.button){return this._mouseUp(event);}
if(this._mouseStarted){this._mouseDrag(event);return event.preventDefault();}
if(this._mouseDistanceMet(event)&&this._mouseDelayMet(event)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,event)!==false);(this._mouseStarted?this._mouseDrag(event):this._mouseUp(event));}
return!this._mouseStarted;},_mouseUp:function(event){$(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(event.target==this._mouseDownEvent.target);this._mouseStop(event);}
return false;},_mouseDistanceMet:function(event){return(Math.max(Math.abs(this._mouseDownEvent.pageX-event.pageX),Math.abs(this._mouseDownEvent.pageY-event.pageY))>=this.options.distance);},_mouseDelayMet:function(event){return this.mouseDelayMet;},_mouseStart:function(event){},_mouseDrag:function(event){},_mouseStop:function(event){},_mouseCapture:function(event){return true;}});})(jQuery);(function($){$.widget("ui.draggable",$.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper=='original'&&!(/^(?:r|a|f)/).test(this.element.css("position")))
this.element[0].style.position='relative';(this.options.addClasses&&this.element.addClass("ui-draggable"));(this.options.disabled&&this.element.addClass("ui-draggable-disabled"));this._mouseInit();},destroy:function(){if(!this.element.data('draggable'))return;this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable"
+" ui-draggable-dragging"
+" ui-draggable-disabled");this._mouseDestroy();return this;},_mouseCapture:function(event){var o=this.options;if(this.helper||o.disabled||$(event.target).is('.ui-resizable-handle'))
return false;this.handle=this._getHandle(event);if(!this.handle)
return false;return true;},_mouseStart:function(event){var o=this.options;this.helper=this._createHelper(event);this._cacheHelperProportions();if($.ui.ddmanager)
$.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));if(o.containment)
this._setContainment();if(this._trigger("start",event)===false){this._clear();return false;}
this._cacheHelperProportions();if($.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(event,true);return true;},_mouseDrag:function(event,noPropagation){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!noPropagation){var ui=this._uiHash();if(this._trigger('drag',event,ui)===false){this._mouseUp({});return false;}
this.position=ui.position;}
if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);return false;},_mouseStop:function(event){var dropped=false;if($.ui.ddmanager&&!this.options.dropBehaviour)
dropped=$.ui.ddmanager.drop(this,event);if(this.dropped){dropped=this.dropped;this.dropped=false;}
if(!this.element[0]||!this.element[0].parentNode)
return false;if((this.options.revert=="invalid"&&!dropped)||(this.options.revert=="valid"&&dropped)||this.options.revert===true||($.isFunction(this.options.revert)&&this.options.revert.call(this.element,dropped))){var self=this;$(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){if(self._trigger("stop",event)!==false){self._clear();}});}else{if(this._trigger("stop",event)!==false){this._clear();}}
return false;},cancel:function(){if(this.helper.is(".ui-draggable-dragging")){this._mouseUp({});}else{this._clear();}
return this;},_getHandle:function(event){var handle=!this.options.handle||!$(this.options.handle,this.element).length?true:false;$(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==event.target)handle=true;});return handle;},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event])):(o.helper=='clone'?this.element.clone():this.element);if(!helper.parents('body').length)
helper.appendTo((o.appendTo=='parent'?this.element[0].parentNode:o.appendTo));if(helper[0]!=this.element[0]&&!(/(fixed|absolute)/).test(helper.css("position")))
helper.css("position","absolute");return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj=='string'){obj=obj.split(' ');}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if('left'in obj){this.offset.click.left=obj.left+this.margins.left;}
if('right'in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if('top'in obj){this.offset.click.top=obj.top+this.margins.top;}
if('bottom'in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.element.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.element.css("marginLeft"),10)||0),top:(parseInt(this.element.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)&&o.containment.constructor!=Array){var ce=$(o.containment)[0];if(!ce)return;var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}else if(o.containment.constructor==Array){this.containment=o.containment;}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+($.browser.safari&&$.browser.version<526&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_clear:function(){this.helper.removeClass("ui-draggable-dragging");if(this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval)this.helper.remove();this.helper=null;this.cancelHelperRemoval=false;},_trigger:function(type,event,ui){ui=ui||this._uiHash();$.ui.plugin.call(this,type,[event,ui]);if(type=="drag")this.positionAbs=this._convertPositionTo("absolute");return $.Widget.prototype._trigger.call(this,type,event,ui);},plugins:{},_uiHash:function(event){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs};}});$.extend($.ui.draggable,{version:"1.8.2"});$.ui.plugin.add("draggable","connectToSortable",{start:function(event,ui){var inst=$(this).data("draggable"),o=inst.options,uiSortable=$.extend({},ui,{item:inst.element});inst.sortables=[];$(o.connectToSortable).each(function(){var sortable=$.data(this,'sortable');if(sortable&&!sortable.options.disabled){inst.sortables.push({instance:sortable,shouldRevert:sortable.options.revert});sortable._refreshItems();sortable._trigger("activate",event,uiSortable);}});},stop:function(event,ui){var inst=$(this).data("draggable"),uiSortable=$.extend({},ui,{item:inst.element});$.each(inst.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;inst.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(event);this.instance.options.helper=this.instance.options._helper;if(inst.options.helper=='original')
this.instance.currentItem.css({top:'auto',left:'auto'});}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",event,uiSortable);}});},drag:function(event,ui){var inst=$(this).data("draggable"),self=this;var checkPos=function(o){var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var helperTop=this.positionAbs.top,helperLeft=this.positionAbs.left;var itemHeight=o.height,itemWidth=o.width;var itemTop=o.top,itemLeft=o.left;return $.ui.isOver(helperTop+dyClick,helperLeft+dxClick,itemTop,itemLeft,itemHeight,itemWidth);};$.each(inst.sortables,function(i){this.instance.positionAbs=inst.positionAbs;this.instance.helperProportions=inst.helperProportions;this.instance.offset.click=inst.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=$(self).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return ui.helper[0];};event.target=this.instance.currentItem[0];this.instance._mouseCapture(event,true);this.instance._mouseStart(event,true,true);this.instance.offset.click.top=inst.offset.click.top;this.instance.offset.click.left=inst.offset.click.left;this.instance.offset.parent.left-=inst.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=inst.offset.parent.top-this.instance.offset.parent.top;inst._trigger("toSortable",event);inst.dropped=this.instance.element;inst.currentItem=inst.element;this.instance.fromOutside=inst;}
if(this.instance.currentItem)this.instance._mouseDrag(event);}else{if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger('out',event,this.instance._uiHash(this.instance));this.instance._mouseStop(event,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();if(this.instance.placeholder)this.instance.placeholder.remove();inst._trigger("fromSortable",event);inst.dropped=false;}};});}});$.ui.plugin.add("draggable","cursor",{start:function(event,ui){var t=$('body'),o=$(this).data('draggable').options;if(t.css("cursor"))o._cursor=t.css("cursor");t.css("cursor",o.cursor);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._cursor)$('body').css("cursor",o._cursor);}});$.ui.plugin.add("draggable","iframeFix",{start:function(event,ui){var o=$(this).data('draggable').options;$(o.iframeFix===true?"iframe":o.iframeFix).each(function(){$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css($(this).offset()).appendTo("body");});},stop:function(event,ui){$("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);});}});$.ui.plugin.add("draggable","opacity",{start:function(event,ui){var t=$(ui.helper),o=$(this).data('draggable').options;if(t.css("opacity"))o._opacity=t.css("opacity");t.css('opacity',o.opacity);},stop:function(event,ui){var o=$(this).data('draggable').options;if(o._opacity)$(ui.helper).css('opacity',o._opacity);}});$.ui.plugin.add("draggable","scroll",{start:function(event,ui){var i=$(this).data("draggable");if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML')i.overflowOffset=i.scrollParent.offset();},drag:function(event,ui){var i=$(this).data("draggable"),o=i.options,scrolled=false;if(i.scrollParent[0]!=document&&i.scrollParent[0].tagName!='HTML'){if(!o.axis||o.axis!='x'){if((i.overflowOffset.top+i.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-i.overflowOffset.top<o.scrollSensitivity)
i.scrollParent[0].scrollTop=scrolled=i.scrollParent[0].scrollTop-o.scrollSpeed;}
if(!o.axis||o.axis!='y'){if((i.overflowOffset.left+i.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-i.overflowOffset.left<o.scrollSensitivity)
i.scrollParent[0].scrollLeft=scrolled=i.scrollParent[0].scrollLeft-o.scrollSpeed;}}else{if(!o.axis||o.axis!='x'){if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);}
if(!o.axis||o.axis!='y'){if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(i,event);}});$.ui.plugin.add("draggable","snap",{start:function(event,ui){var i=$(this).data("draggable"),o=i.options;i.snapElements=[];$(o.snap.constructor!=String?(o.snap.items||':data(draggable)'):o.snap).each(function(){var $t=$(this);var $o=$t.offset();if(this!=i.element[0])i.snapElements.push({item:this,width:$t.outerWidth(),height:$t.outerHeight(),top:$o.top,left:$o.left});});},drag:function(event,ui){var inst=$(this).data("draggable"),o=inst.options;var d=o.snapTolerance;var x1=ui.offset.left,x2=x1+inst.helperProportions.width,y1=ui.offset.top,y2=y1+inst.helperProportions.height;for(var i=inst.snapElements.length-1;i>=0;i--){var l=inst.snapElements[i].left,r=l+inst.snapElements[i].width,t=inst.snapElements[i].top,b=t+inst.snapElements[i].height;if(!((l-d<x1&&x1<r+d&&t-d<y1&&y1<b+d)||(l-d<x1&&x1<r+d&&t-d<y2&&y2<b+d)||(l-d<x2&&x2<r+d&&t-d<y1&&y1<b+d)||(l-d<x2&&x2<r+d&&t-d<y2&&y2<b+d))){if(inst.snapElements[i].snapping)(inst.options.snap.release&&inst.options.snap.release.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=false;continue;}
if(o.snapMode!='inner'){var ts=Math.abs(t-y2)<=d;var bs=Math.abs(b-y1)<=d;var ls=Math.abs(l-x2)<=d;var rs=Math.abs(r-x1)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t-inst.helperProportions.height,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l-inst.helperProportions.width}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r}).left-inst.margins.left;}
var first=(ts||bs||ls||rs);if(o.snapMode!='outer'){var ts=Math.abs(t-y1)<=d;var bs=Math.abs(b-y2)<=d;var ls=Math.abs(l-x1)<=d;var rs=Math.abs(r-x2)<=d;if(ts)ui.position.top=inst._convertPositionTo("relative",{top:t,left:0}).top-inst.margins.top;if(bs)ui.position.top=inst._convertPositionTo("relative",{top:b-inst.helperProportions.height,left:0}).top-inst.margins.top;if(ls)ui.position.left=inst._convertPositionTo("relative",{top:0,left:l}).left-inst.margins.left;if(rs)ui.position.left=inst._convertPositionTo("relative",{top:0,left:r-inst.helperProportions.width}).left-inst.margins.left;}
if(!inst.snapElements[i].snapping&&(ts||bs||ls||rs||first))
(inst.options.snap.snap&&inst.options.snap.snap.call(inst.element,event,$.extend(inst._uiHash(),{snapItem:inst.snapElements[i].item})));inst.snapElements[i].snapping=(ts||bs||ls||rs||first);};}});$.ui.plugin.add("draggable","stack",{start:function(event,ui){var o=$(this).data("draggable").options;var group=$.makeArray($(o.stack)).sort(function(a,b){return(parseInt($(a).css("zIndex"),10)||0)-(parseInt($(b).css("zIndex"),10)||0);});if(!group.length){return;}
var min=parseInt(group[0].style.zIndex)||0;$(group).each(function(i){this.style.zIndex=min+i;});this[0].style.zIndex=min+group.length;}});$.ui.plugin.add("draggable","zIndex",{start:function(event,ui){var t=$(ui.helper),o=$(this).data("draggable").options;if(t.css("zIndex"))o._zIndex=t.css("zIndex");t.css('zIndex',o.zIndex);},stop:function(event,ui){var o=$(this).data("draggable").options;if(o._zIndex)$(ui.helper).css('zIndex',o._zIndex);}});})(jQuery);(function($){$.widget("ui.sortable",$.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:'auto',cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:'> *',opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000},_create:function(){var o=this.options;this.containerCache={};this.element.addClass("ui-sortable");this.refresh();this.floating=this.items.length?(/left|right/).test(this.items[0].item.css('float')):false;this.offset=this.element.offset();this._mouseInit();},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var i=this.items.length-1;i>=0;i--)
this.items[i].item.removeData("sortable-item");return this;},_setOption:function(key,value){if(key==="disabled"){this.options[key]=value;this.widget()
[value?"addClass":"removeClass"]("ui-sortable-disabled");}else{$.Widget.prototype._setOption.apply(this,arguments);}},_mouseCapture:function(event,overrideHandle){if(this.reverting){return false;}
if(this.options.disabled||this.options.type=='static')return false;this._refreshItems(event);var currentItem=null,self=this,nodes=$(event.target).parents().each(function(){if($.data(this,'sortable-item')==self){currentItem=$(this);return false;}});if($.data(event.target,'sortable-item')==self)currentItem=$(event.target);if(!currentItem)return false;if(this.options.handle&&!overrideHandle){var validHandle=false;$(this.options.handle,currentItem).find("*").andSelf().each(function(){if(this==event.target)validHandle=true;});if(!validHandle)return false;}
this.currentItem=currentItem;this._removeCurrentsFromItems();return true;},_mouseStart:function(event,overrideHandle,noActivation){var o=this.options,self=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(event);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");$.extend(this.offset,{click:{left:event.pageX-this.offset.left,top:event.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(event);this.originalPageX=event.pageX;this.originalPageY=event.pageY;(o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt));this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide();}
this._createPlaceholder();if(o.containment)
this._setContainment();if(o.cursor){if($('body').css("cursor"))this._storedCursor=$('body').css("cursor");$('body').css("cursor",o.cursor);}
if(o.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",o.opacity);}
if(o.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",o.zIndex);}
if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML')
this.overflowOffset=this.scrollParent.offset();this._trigger("start",event,this._uiHash());if(!this._preserveHelperProportions)
this._cacheHelperProportions();if(!noActivation){for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("activate",event,self._uiHash(this));}}
if($.ui.ddmanager)
$.ui.ddmanager.current=this;if($.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(event);return true;},_mouseDrag:function(event){this.position=this._generatePosition(event);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs;}
if(this.options.scroll){var o=this.options,scrolled=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!='HTML'){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-event.pageY<o.scrollSensitivity)
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop+o.scrollSpeed;else if(event.pageY-this.overflowOffset.top<o.scrollSensitivity)
this.scrollParent[0].scrollTop=scrolled=this.scrollParent[0].scrollTop-o.scrollSpeed;if((this.overflowOffset.left+this.scrollParent[0].offsetWidth)-event.pageX<o.scrollSensitivity)
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft+o.scrollSpeed;else if(event.pageX-this.overflowOffset.left<o.scrollSensitivity)
this.scrollParent[0].scrollLeft=scrolled=this.scrollParent[0].scrollLeft-o.scrollSpeed;}else{if(event.pageY-$(document).scrollTop()<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()-o.scrollSpeed);else if($(window).height()-(event.pageY-$(document).scrollTop())<o.scrollSensitivity)
scrolled=$(document).scrollTop($(document).scrollTop()+o.scrollSpeed);if(event.pageX-$(document).scrollLeft()<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()-o.scrollSpeed);else if($(window).width()-(event.pageX-$(document).scrollLeft())<o.scrollSensitivity)
scrolled=$(document).scrollLeft($(document).scrollLeft()+o.scrollSpeed);}
if(scrolled!==false&&$.ui.ddmanager&&!o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this,event);}
this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+'px';if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+'px';for(var i=this.items.length-1;i>=0;i--){var item=this.items[i],itemElement=item.item[0],intersection=this._intersectsWithPointer(item);if(!intersection)continue;if(itemElement!=this.currentItem[0]&&this.placeholder[intersection==1?"next":"prev"]()[0]!=itemElement&&!$.ui.contains(this.placeholder[0],itemElement)&&(this.options.type=='semi-dynamic'?!$.ui.contains(this.element[0],itemElement):true)){this.direction=intersection==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(item)){this._rearrange(event,item);}else{break;}
this._trigger("change",event,this._uiHash());break;}}
this._contactContainers(event);if($.ui.ddmanager)$.ui.ddmanager.drag(this,event);this._trigger('sort',event,this._uiHash());this.lastPositionAbs=this.positionAbs;return false;},_mouseStop:function(event,noPropagation){if(!event)return;if($.ui.ddmanager&&!this.options.dropBehaviour)
$.ui.ddmanager.drop(this,event);if(this.options.revert){var self=this;var cur=self.placeholder.offset();self.reverting=true;$(this.helper).animate({left:cur.left-this.offset.parent.left-self.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:cur.top-this.offset.parent.top-self.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){self._clear(event);});}else{this._clear(event,noPropagation);}
return false;},cancel:function(){var self=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original")
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");else
this.currentItem.show();for(var i=this.containers.length-1;i>=0;i--){this.containers[i]._trigger("deactivate",null,self._uiHash(this));if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",null,self._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(this.placeholder[0].parentNode)this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode)this.helper.remove();$.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){$(this.domPosition.prev).after(this.currentItem);}else{$(this.domPosition.parent).prepend(this.currentItem);}
return this;},serialize:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var str=[];o=o||{};$(items).each(function(){var res=($(o.item||this).attr(o.attribute||'id')||'').match(o.expression||(/(.+)[-=_](.+)/));if(res)str.push((o.key||res[1]+'[]')+'='+(o.key&&o.expression?res[1]:res[2]));});return str.join('&');},toArray:function(o){var items=this._getItemsAsjQuery(o&&o.connected);var ret=[];o=o||{};items.each(function(){ret.push($(o.item||this).attr(o.attribute||'id')||'');});return ret;},_intersectsWith:function(item){var x1=this.positionAbs.left,x2=x1+this.helperProportions.width,y1=this.positionAbs.top,y2=y1+this.helperProportions.height;var l=item.left,r=l+item.width,t=item.top,b=t+item.height;var dyClick=this.offset.click.top,dxClick=this.offset.click.left;var isOverElement=(y1+dyClick)>t&&(y1+dyClick)<b&&(x1+dxClick)>l&&(x1+dxClick)<r;if(this.options.tolerance=="pointer"||this.options.forcePointerForContainers||(this.options.tolerance!="pointer"&&this.helperProportions[this.floating?'width':'height']>item[this.floating?'width':'height'])){return isOverElement;}else{return(l<x1+(this.helperProportions.width/2)&&x2-(this.helperProportions.width/2)<r&&t<y1+(this.helperProportions.height/2)&&y2-(this.helperProportions.height/2)<b);}},_intersectsWithPointer:function(item){var isOverElementHeight=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top,item.height),isOverElementWidth=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left,item.width),isOverElement=isOverElementHeight&&isOverElementWidth,verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(!isOverElement)
return false;return this.floating?(((horizontalDirection&&horizontalDirection=="right")||verticalDirection=="down")?2:1):(verticalDirection&&(verticalDirection=="down"?2:1));},_intersectsWithSides:function(item){var isOverBottomHalf=$.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,item.top+(item.height/2),item.height),isOverRightHalf=$.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,item.left+(item.width/2),item.width),verticalDirection=this._getDragVerticalDirection(),horizontalDirection=this._getDragHorizontalDirection();if(this.floating&&horizontalDirection){return((horizontalDirection=="right"&&isOverRightHalf)||(horizontalDirection=="left"&&!isOverRightHalf));}else{return verticalDirection&&((verticalDirection=="down"&&isOverBottomHalf)||(verticalDirection=="up"&&!isOverBottomHalf));}},_getDragVerticalDirection:function(){var delta=this.positionAbs.top-this.lastPositionAbs.top;return delta!=0&&(delta>0?"down":"up");},_getDragHorizontalDirection:function(){var delta=this.positionAbs.left-this.lastPositionAbs.left;return delta!=0&&(delta>0?"right":"left");},refresh:function(event){this._refreshItems(event);this.refreshPositions();return this;},_connectWith:function(){var options=this.options;return options.connectWith.constructor==String?[options.connectWith]:options.connectWith;},_getItemsAsjQuery:function(connected){var self=this;var items=[];var queries=[];var connectWith=this._connectWith();if(connectWith&&connected){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element):$(inst.options.items,inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),inst]);}};};}
queries.push([$.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):$(this.options.items,this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'),this]);for(var i=queries.length-1;i>=0;i--){queries[i][0].each(function(){items.push(this);});};return $(items);},_removeCurrentsFromItems:function(){var list=this.currentItem.find(":data(sortable-item)");for(var i=0;i<this.items.length;i++){for(var j=0;j<list.length;j++){if(list[j]==this.items[i].item[0])
this.items.splice(i,1);};};},_refreshItems:function(event){this.items=[];this.containers=[this];var items=this.items;var self=this;var queries=[[$.isFunction(this.options.items)?this.options.items.call(this.element[0],event,{item:this.currentItem}):$(this.options.items,this.element),this]];var connectWith=this._connectWith();if(connectWith){for(var i=connectWith.length-1;i>=0;i--){var cur=$(connectWith[i]);for(var j=cur.length-1;j>=0;j--){var inst=$.data(cur[j],'sortable');if(inst&&inst!=this&&!inst.options.disabled){queries.push([$.isFunction(inst.options.items)?inst.options.items.call(inst.element[0],event,{item:this.currentItem}):$(inst.options.items,inst.element),inst]);this.containers.push(inst);}};};}
for(var i=queries.length-1;i>=0;i--){var targetData=queries[i][1];var _queries=queries[i][0];for(var j=0,queriesLength=_queries.length;j<queriesLength;j++){var item=$(_queries[j]);item.data('sortable-item',targetData);items.push({item:item,instance:targetData,width:0,height:0,left:0,top:0});};};},refreshPositions:function(fast){if(this.offsetParent&&this.helper){this.offset.parent=this._getParentOffset();}
for(var i=this.items.length-1;i>=0;i--){var item=this.items[i];var t=this.options.toleranceElement?$(this.options.toleranceElement,item.item):item.item;if(!fast){item.width=t.outerWidth();item.height=t.outerHeight();}
var p=t.offset();item.left=p.left;item.top=p.top;};if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this);}else{for(var i=this.containers.length-1;i>=0;i--){var p=this.containers[i].element.offset();this.containers[i].containerCache.left=p.left;this.containers[i].containerCache.top=p.top;this.containers[i].containerCache.width=this.containers[i].element.outerWidth();this.containers[i].containerCache.height=this.containers[i].element.outerHeight();};}
return this;},_createPlaceholder:function(that){var self=that||this,o=self.options;if(!o.placeholder||o.placeholder.constructor==String){var className=o.placeholder;o.placeholder={element:function(){var el=$(document.createElement(self.currentItem[0].nodeName)).addClass(className||self.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!className)
el.style.visibility="hidden";return el;},update:function(container,p){if(className&&!o.forcePlaceholderSize)return;if(!p.height()){p.height(self.currentItem.innerHeight()-parseInt(self.currentItem.css('paddingTop')||0,10)-parseInt(self.currentItem.css('paddingBottom')||0,10));};if(!p.width()){p.width(self.currentItem.innerWidth()-parseInt(self.currentItem.css('paddingLeft')||0,10)-parseInt(self.currentItem.css('paddingRight')||0,10));};}};}
self.placeholder=$(o.placeholder.element.call(self.element,self.currentItem));self.currentItem.after(self.placeholder);o.placeholder.update(self,self.placeholder);},_contactContainers:function(event){var innermostContainer=null,innermostIndex=null;for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.currentItem[0],this.containers[i].element[0]))
continue;if(this._intersectsWith(this.containers[i].containerCache)){if(innermostContainer&&$.ui.contains(this.containers[i].element[0],innermostContainer.element[0]))
continue;innermostContainer=this.containers[i];innermostIndex=i;}else{if(this.containers[i].containerCache.over){this.containers[i]._trigger("out",event,this._uiHash(this));this.containers[i].containerCache.over=0;}}}
if(!innermostContainer)return;if(this.containers.length===1){this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}else if(this.currentContainer!=this.containers[innermostIndex]){var dist=10000;var itemWithLeastDistance=null;var base=this.positionAbs[this.containers[innermostIndex].floating?'left':'top'];for(var j=this.items.length-1;j>=0;j--){if(!$.ui.contains(this.containers[innermostIndex].element[0],this.items[j].item[0]))continue;var cur=this.items[j][this.containers[innermostIndex].floating?'left':'top'];if(Math.abs(cur-base)<dist){dist=Math.abs(cur-base);itemWithLeastDistance=this.items[j];}}
if(!itemWithLeastDistance&&!this.options.dropOnEmpty)
return;this.currentContainer=this.containers[innermostIndex];itemWithLeastDistance?this._rearrange(event,itemWithLeastDistance,null,true):this._rearrange(event,null,this.containers[innermostIndex].element,true);this._trigger("change",event,this._uiHash());this.containers[innermostIndex]._trigger("change",event,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[innermostIndex]._trigger("over",event,this._uiHash(this));this.containers[innermostIndex].containerCache.over=1;}},_createHelper:function(event){var o=this.options;var helper=$.isFunction(o.helper)?$(o.helper.apply(this.element[0],[event,this.currentItem])):(o.helper=='clone'?this.currentItem.clone():this.currentItem);if(!helper.parents('body').length)
$(o.appendTo!='parent'?o.appendTo:this.currentItem[0].parentNode)[0].appendChild(helper[0]);if(helper[0]==this.currentItem[0])
this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(helper[0].style.width==''||o.forceHelperSize)helper.width(this.currentItem.width());if(helper[0].style.height==''||o.forceHelperSize)helper.height(this.currentItem.height());return helper;},_adjustOffsetFromHelper:function(obj){if(typeof obj=='string'){obj=obj.split(' ');}
if($.isArray(obj)){obj={left:+obj[0],top:+obj[1]||0};}
if('left'in obj){this.offset.click.left=obj.left+this.margins.left;}
if('right'in obj){this.offset.click.left=this.helperProportions.width-obj.right+this.margins.left;}
if('top'in obj){this.offset.click.top=obj.top+this.margins.top;}
if('bottom'in obj){this.offset.click.top=this.helperProportions.height-obj.bottom+this.margins.top;}},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var po=this.offsetParent.offset();if(this.cssPosition=='absolute'&&this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0])){po.left+=this.scrollParent.scrollLeft();po.top+=this.scrollParent.scrollTop();}
if((this.offsetParent[0]==document.body)||(this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=='html'&&$.browser.msie))
po={top:0,left:0};return{top:po.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:po.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var p=this.currentItem.position();return{top:p.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:p.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}else{return{top:0,left:0};}},_cacheMargins:function(){this.margins={left:(parseInt(this.currentItem.css("marginLeft"),10)||0),top:(parseInt(this.currentItem.css("marginTop"),10)||0)};},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function(){var o=this.options;if(o.containment=='parent')o.containment=this.helper[0].parentNode;if(o.containment=='document'||o.containment=='window')this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,$(o.containment=='document'?document:window).width()-this.helperProportions.width-this.margins.left,($(o.containment=='document'?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!(/^(document|window|parent)$/).test(o.containment)){var ce=$(o.containment)[0];var co=$(o.containment).offset();var over=($(ce).css("overflow")!='hidden');this.containment=[co.left+(parseInt($(ce).css("borderLeftWidth"),10)||0)+(parseInt($(ce).css("paddingLeft"),10)||0)-this.margins.left,co.top+(parseInt($(ce).css("borderTopWidth"),10)||0)+(parseInt($(ce).css("paddingTop"),10)||0)-this.margins.top,co.left+(over?Math.max(ce.scrollWidth,ce.offsetWidth):ce.offsetWidth)-(parseInt($(ce).css("borderLeftWidth"),10)||0)-(parseInt($(ce).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,co.top+(over?Math.max(ce.scrollHeight,ce.offsetHeight):ce.offsetHeight)-(parseInt($(ce).css("borderTopWidth"),10)||0)-(parseInt($(ce).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top];}},_convertPositionTo:function(d,pos){if(!pos)pos=this.position;var mod=d=="absolute"?1:-1;var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);return{top:(pos.top
+this.offset.relative.top*mod
+this.offset.parent.top*mod
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop()))*mod)),left:(pos.left
+this.offset.relative.left*mod
+this.offset.parent.left*mod
-($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())*mod))};},_generatePosition:function(event){var o=this.options,scroll=this.cssPosition=='absolute'&&!(this.scrollParent[0]!=document&&$.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,scrollIsRootNode=(/(html|body)/i).test(scroll[0].tagName);if(this.cssPosition=='relative'&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0])){this.offset.relative=this._getRelativeOffset();}
var pageX=event.pageX;var pageY=event.pageY;if(this.originalPosition){if(this.containment){if(event.pageX-this.offset.click.left<this.containment[0])pageX=this.containment[0]+this.offset.click.left;if(event.pageY-this.offset.click.top<this.containment[1])pageY=this.containment[1]+this.offset.click.top;if(event.pageX-this.offset.click.left>this.containment[2])pageX=this.containment[2]+this.offset.click.left;if(event.pageY-this.offset.click.top>this.containment[3])pageY=this.containment[3]+this.offset.click.top;}
if(o.grid){var top=this.originalPageY+Math.round((pageY-this.originalPageY)/o.grid[1])*o.grid[1];pageY=this.containment?(!(top-this.offset.click.top<this.containment[1]||top-this.offset.click.top>this.containment[3])?top:(!(top-this.offset.click.top<this.containment[1])?top-o.grid[1]:top+o.grid[1])):top;var left=this.originalPageX+Math.round((pageX-this.originalPageX)/o.grid[0])*o.grid[0];pageX=this.containment?(!(left-this.offset.click.left<this.containment[0]||left-this.offset.click.left>this.containment[2])?left:(!(left-this.offset.click.left<this.containment[0])?left-o.grid[0]:left+o.grid[0])):left;}}
return{top:(pageY
-this.offset.click.top
-this.offset.relative.top
-this.offset.parent.top
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollTop():(scrollIsRootNode?0:scroll.scrollTop())))),left:(pageX
-this.offset.click.left
-this.offset.relative.left
-this.offset.parent.left
+($.browser.safari&&this.cssPosition=='fixed'?0:(this.cssPosition=='fixed'?-this.scrollParent.scrollLeft():scrollIsRootNode?0:scroll.scrollLeft())))};},_rearrange:function(event,i,a,hardRefresh){a?a[0].appendChild(this.placeholder[0]):i.item[0].parentNode.insertBefore(this.placeholder[0],(this.direction=='down'?i.item[0]:i.item[0].nextSibling));this.counter=this.counter?++this.counter:1;var self=this,counter=this.counter;window.setTimeout(function(){if(counter==self.counter)self.refreshPositions(!hardRefresh);},0);},_clear:function(event,noPropagation){this.reverting=false;var delayedTriggers=[],self=this;if(!this._noFinalSort&&this.currentItem[0].parentNode)this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS){if(this._storedCSS[i]=='auto'||this._storedCSS[i]=='static')this._storedCSS[i]='';}
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else{this.currentItem.show();}
if(this.fromOutside&&!noPropagation)delayedTriggers.push(function(event){this._trigger("receive",event,this._uiHash(this.fromOutside));});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!noPropagation)delayedTriggers.push(function(event){this._trigger("update",event,this._uiHash());});if(!$.ui.contains(this.element[0],this.currentItem[0])){if(!noPropagation)delayedTriggers.push(function(event){this._trigger("remove",event,this._uiHash());});for(var i=this.containers.length-1;i>=0;i--){if($.ui.contains(this.containers[i].element[0],this.currentItem[0])&&!noPropagation){delayedTriggers.push((function(c){return function(event){c._trigger("receive",event,this._uiHash(this));};}).call(this,this.containers[i]));delayedTriggers.push((function(c){return function(event){c._trigger("update",event,this._uiHash(this));};}).call(this,this.containers[i]));}};};for(var i=this.containers.length-1;i>=0;i--){if(!noPropagation)delayedTriggers.push((function(c){return function(event){c._trigger("deactivate",event,this._uiHash(this));};}).call(this,this.containers[i]));if(this.containers[i].containerCache.over){delayedTriggers.push((function(c){return function(event){c._trigger("out",event,this._uiHash(this));};}).call(this,this.containers[i]));this.containers[i].containerCache.over=0;}}
if(this._storedCursor)$('body').css("cursor",this._storedCursor);if(this._storedOpacity)this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=='auto'?'':this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!noPropagation){this._trigger("beforeStop",event,this._uiHash());for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
return false;}
if(!noPropagation)this._trigger("beforeStop",event,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);if(this.helper[0]!=this.currentItem[0])this.helper.remove();this.helper=null;if(!noPropagation){for(var i=0;i<delayedTriggers.length;i++){delayedTriggers[i].call(this,event);};this._trigger("stop",event,this._uiHash());}
this.fromOutside=false;return true;},_trigger:function(){if($.Widget.prototype._trigger.apply(this,arguments)===false){this.cancel();}},_uiHash:function(inst){var self=inst||this;return{helper:self.helper,placeholder:self.placeholder||$([]),position:self.position,originalPosition:self.originalPosition,offset:self.positionAbs,item:self.currentItem,sender:inst?inst.element:null};}});$.extend($.ui.sortable,{version:"1.8.2"});})(jQuery);(function($){$.ui=$.ui||{};var horizontalPositions=/left|center|right/,horizontalDefault="center",verticalPositions=/top|center|bottom/,verticalDefault="center",_position=$.fn.position,_offset=$.fn.offset;$.fn.position=function(options){if(!options||!options.of){return _position.apply(this,arguments);}
options=$.extend({},options);var target=$(options.of),collision=(options.collision||"flip").split(" "),offset=options.offset?options.offset.split(" "):[0,0],targetWidth,targetHeight,basePosition;if(options.of.nodeType===9){targetWidth=target.width();targetHeight=target.height();basePosition={top:0,left:0};}else if(options.of.scrollTo&&options.of.document){targetWidth=target.width();targetHeight=target.height();basePosition={top:target.scrollTop(),left:target.scrollLeft()};}else if(options.of.preventDefault){options.at="left top";targetWidth=targetHeight=0;basePosition={top:options.of.pageY,left:options.of.pageX};}else{targetWidth=target.outerWidth();targetHeight=target.outerHeight();basePosition=target.offset();}
$.each(["my","at"],function(){var pos=(options[this]||"").split(" ");if(pos.length===1){pos=horizontalPositions.test(pos[0])?pos.concat([verticalDefault]):verticalPositions.test(pos[0])?[horizontalDefault].concat(pos):[horizontalDefault,verticalDefault];}
pos[0]=horizontalPositions.test(pos[0])?pos[0]:horizontalDefault;pos[1]=verticalPositions.test(pos[1])?pos[1]:verticalDefault;options[this]=pos;});if(collision.length===1){collision[1]=collision[0];}
offset[0]=parseInt(offset[0],10)||0;if(offset.length===1){offset[1]=offset[0];}
offset[1]=parseInt(offset[1],10)||0;if(options.at[0]==="right"){basePosition.left+=targetWidth;}else if(options.at[0]===horizontalDefault){basePosition.left+=targetWidth/2;}
if(options.at[1]==="bottom"){basePosition.top+=targetHeight;}else if(options.at[1]===verticalDefault){basePosition.top+=targetHeight/2;}
basePosition.left+=offset[0];basePosition.top+=offset[1];return this.each(function(){var elem=$(this),elemWidth=elem.outerWidth(),elemHeight=elem.outerHeight(),position=$.extend({},basePosition);if(options.my[0]==="right"){position.left-=elemWidth;}else if(options.my[0]===horizontalDefault){position.left-=elemWidth/2;}
if(options.my[1]==="bottom"){position.top-=elemHeight;}else if(options.my[1]===verticalDefault){position.top-=elemHeight/2;}
position.left=parseInt(position.left);position.top=parseInt(position.top);$.each(["left","top"],function(i,dir){if($.ui.position[collision[i]]){$.ui.position[collision[i]][dir](position,{targetWidth:targetWidth,targetHeight:targetHeight,elemWidth:elemWidth,elemHeight:elemHeight,offset:offset,my:options.my,at:options.at});}});if($.fn.bgiframe){elem.bgiframe();}
elem.offset($.extend(position,{using:options.using}));});};$.ui.position={fit:{left:function(position,data){var win=$(window),over=position.left+data.elemWidth-win.width()-win.scrollLeft();position.left=over>0?position.left-over:Math.max(0,position.left);},top:function(position,data){var win=$(window),over=position.top+data.elemHeight-win.height()-win.scrollTop();position.top=over>0?position.top-over:Math.max(0,position.top);}},flip:{left:function(position,data){if(data.at[0]==="center"){return;}
var win=$(window),over=position.left+data.elemWidth-win.width()-win.scrollLeft(),myOffset=data.my[0]==="left"?-data.elemWidth:data.my[0]==="right"?data.elemWidth:0,offset=-2*data.offset[0];position.left+=position.left<0?myOffset+data.targetWidth+offset:over>0?myOffset-data.targetWidth+offset:0;},top:function(position,data){if(data.at[1]==="center"){return;}
var win=$(window),over=position.top+data.elemHeight-win.height()-win.scrollTop(),myOffset=data.my[1]==="top"?-data.elemHeight:data.my[1]==="bottom"?data.elemHeight:0,atOffset=data.at[1]==="top"?data.targetHeight:-data.targetHeight,offset=-2*data.offset[1];position.top+=position.top<0?myOffset+data.targetHeight+offset:over>0?myOffset+atOffset+offset:0;}}};if(!$.offset.setOffset){$.offset.setOffset=function(elem,options){if(/static/.test($.curCSS(elem,"position"))){elem.style.position="relative";}
var curElem=$(elem),curOffset=curElem.offset(),curTop=parseInt($.curCSS(elem,"top",true),10)||0,curLeft=parseInt($.curCSS(elem,"left",true),10)||0,props={top:(options.top-curOffset.top)+curTop,left:(options.left-curOffset.left)+curLeft};if('using'in options){options.using.call(elem,props);}else{curElem.css(props);}};$.fn.offset=function(options){var elem=this[0];if(!elem||!elem.ownerDocument){return null;}
if(options){return this.each(function(){$.offset.setOffset(this,options);});}
return _offset.call(this);};}}(jQuery));(function($){var numPages=5;$.widget("ui.slider",$.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var self=this,o=this.options;this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider"+" ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all");if(o.disabled){this.element.addClass("ui-slider-disabled ui-disabled");}
this.range=$([]);if(o.range){if(o.range===true){this.range=$("<div></div>");if(!o.values){o.values=[this._valueMin(),this._valueMin()];}
if(o.values.length&&o.values.length!==2){o.values=[o.values[0],o.values[0]];}}else{this.range=$("<div></div>");}
this.range.appendTo(this.element).addClass("ui-slider-range");if(o.range==="min"||o.range==="max"){this.range.addClass("ui-slider-range-"+o.range);}
this.range.addClass("ui-widget-header");}
if($(".ui-slider-handle",this.element).length===0){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");}
if(o.values&&o.values.length){while($(".ui-slider-handle",this.element).length<o.values.length){$("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");}}
this.handles=$(".ui-slider-handle",this.element).addClass("ui-state-default"+" ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(event){event.preventDefault();}).hover(function(){if(!o.disabled){$(this).addClass("ui-state-hover");}},function(){$(this).removeClass("ui-state-hover");}).focus(function(){if(!o.disabled){$(".ui-slider .ui-state-focus").removeClass("ui-state-focus");$(this).addClass("ui-state-focus");}else{$(this).blur();}}).blur(function(){$(this).removeClass("ui-state-focus");});this.handles.each(function(i){$(this).data("index.ui-slider-handle",i);});this.handles.keydown(function(event){var ret=true,index=$(this).data("index.ui-slider-handle"),allowed,curVal,newVal,step;if(self.options.disabled){return;}
switch(event.keyCode){case $.ui.keyCode.HOME:case $.ui.keyCode.END:case $.ui.keyCode.PAGE_UP:case $.ui.keyCode.PAGE_DOWN:case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:ret=false;if(!self._keySliding){self._keySliding=true;$(this).addClass("ui-state-active");allowed=self._start(event,index);if(allowed===false){return;}}
break;}
step=self.options.step;if(self.options.values&&self.options.values.length){curVal=newVal=self.values(index);}else{curVal=newVal=self.value();}
switch(event.keyCode){case $.ui.keyCode.HOME:newVal=self._valueMin();break;case $.ui.keyCode.END:newVal=self._valueMax();break;case $.ui.keyCode.PAGE_UP:newVal=self._trimAlignValue(curVal+((self._valueMax()-self._valueMin())/numPages));break;case $.ui.keyCode.PAGE_DOWN:newVal=self._trimAlignValue(curVal-((self._valueMax()-self._valueMin())/numPages));break;case $.ui.keyCode.UP:case $.ui.keyCode.RIGHT:if(curVal===self._valueMax()){return;}
newVal=self._trimAlignValue(curVal+step);break;case $.ui.keyCode.DOWN:case $.ui.keyCode.LEFT:if(curVal===self._valueMin()){return;}
newVal=self._trimAlignValue(curVal-step);break;}
self._slide(event,index,newVal);return ret;}).keyup(function(event){var index=$(this).data("index.ui-slider-handle");if(self._keySliding){self._keySliding=false;self._stop(event,index);self._change(event,index);$(this).removeClass("ui-state-active");}});this._refreshValue();this._animateOff=false;},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider"+" ui-slider-horizontal"+" ui-slider-vertical"+" ui-slider-disabled"+" ui-widget"+" ui-widget-content"+" ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();return this;},_mouseCapture:function(event){var o=this.options,position,normValue,distance,closestHandle,self,index,allowed,offset,mouseOverHandle;if(o.disabled){return false;}
this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();position={x:event.pageX,y:event.pageY};normValue=this._normValueFromMouse(position);distance=this._valueMax()-this._valueMin()+1;self=this;this.handles.each(function(i){var thisDistance=Math.abs(normValue-self.values(i));if(distance>thisDistance){distance=thisDistance;closestHandle=$(this);index=i;}});if(o.range===true&&this.values(1)===o.min){index+=1;closestHandle=$(this.handles[index]);}
allowed=this._start(event,index);if(allowed===false){return false;}
this._mouseSliding=true;self._handleIndex=index;closestHandle.addClass("ui-state-active").focus();offset=closestHandle.offset();mouseOverHandle=!$(event.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=mouseOverHandle?{left:0,top:0}:{left:event.pageX-offset.left-(closestHandle.width()/2),top:event.pageY-offset.top-
(closestHandle.height()/2)-
(parseInt(closestHandle.css("borderTopWidth"),10)||0)-
(parseInt(closestHandle.css("borderBottomWidth"),10)||0)+
(parseInt(closestHandle.css("marginTop"),10)||0)};normValue=this._normValueFromMouse(position);this._slide(event,index,normValue);this._animateOff=true;return true;},_mouseStart:function(event){return true;},_mouseDrag:function(event){var position={x:event.pageX,y:event.pageY},normValue=this._normValueFromMouse(position);this._slide(event,this._handleIndex,normValue);return false;},_mouseStop:function(event){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(event,this._handleIndex);this._change(event,this._handleIndex);this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false;},_detectOrientation:function(){this.orientation=(this.options.orientation==="vertical")?"vertical":"horizontal";},_normValueFromMouse:function(position){var pixelTotal,pixelMouse,percentMouse,valueTotal,valueMouse;if(this.orientation==="horizontal"){pixelTotal=this.elementSize.width;pixelMouse=position.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0);}else{pixelTotal=this.elementSize.height;pixelMouse=position.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0);}
percentMouse=(pixelMouse/pixelTotal);if(percentMouse>1){percentMouse=1;}
if(percentMouse<0){percentMouse=0;}
if(this.orientation==="vertical"){percentMouse=1-percentMouse;}
valueTotal=this._valueMax()-this._valueMin();valueMouse=this._valueMin()+percentMouse*valueTotal;return this._trimAlignValue(valueMouse);},_start:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
return this._trigger("start",event,uiHash);},_slide:function(event,index,newVal){var otherVal,newValues,allowed;if(this.options.values&&this.options.values.length){otherVal=this.values(index?0:1);if((this.options.values.length===2&&this.options.range===true)&&((index===0&&newVal>otherVal)||(index===1&&newVal<otherVal))){newVal=otherVal;}
if(newVal!==this.values(index)){newValues=this.values();newValues[index]=newVal;allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal,values:newValues});otherVal=this.values(index?0:1);if(allowed!==false){this.values(index,newVal,true);}}}else{if(newVal!==this.value()){allowed=this._trigger("slide",event,{handle:this.handles[index],value:newVal});if(allowed!==false){this.value(newVal);}}}},_stop:function(event,index){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._trigger("stop",event,uiHash);},_change:function(event,index){if(!this._keySliding&&!this._mouseSliding){var uiHash={handle:this.handles[index],value:this.value()};if(this.options.values&&this.options.values.length){uiHash.value=this.values(index);uiHash.values=this.values();}
this._trigger("change",event,uiHash);}},value:function(newValue){if(arguments.length){this.options.value=this._trimAlignValue(newValue);this._refreshValue();this._change(null,0);}
return this._value();},values:function(index,newValue){var vals,newValues,i;if(arguments.length>1){this.options.values[index]=this._trimAlignValue(newValue);this._refreshValue();this._change(null,index);}
if(arguments.length){if($.isArray(arguments[0])){vals=this.options.values;newValues=arguments[0];for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(newValues[i]);this._change(null,i);}
this._refreshValue();}else{if(this.options.values&&this.options.values.length){return this._values(index);}else{return this.value();}}}else{return this._values();}},_setOption:function(key,value){var i,valsLength=0;if($.isArray(this.options.values)){valsLength=this.options.values.length;}
$.Widget.prototype._setOption.apply(this,arguments);switch(key){case"disabled":if(value){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled");}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled");}
break;case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case"value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();for(i=0;i<valsLength;i+=1){this._change(null,i);}
this._animateOff=false;break;}},_value:function(){var val=this.options.value;val=this._trimAlignValue(val);return val;},_values:function(index){var val,vals,i;if(arguments.length){val=this.options.values[index];val=this._trimAlignValue(val);return val;}else{vals=this.options.values.slice();for(i=0;i<vals.length;i+=1){vals[i]=this._trimAlignValue(vals[i]);}
return vals;}},_trimAlignValue:function(val){if(val<this._valueMin()){return this._valueMin();}
if(val>this._valueMax()){return this._valueMax();}
var step=(this.options.step>0)?this.options.step:1,valModStep=val%step,alignValue=val-valModStep;if(Math.abs(valModStep)*2>=step){alignValue+=(valModStep>0)?step:(-step);}
return parseFloat(alignValue.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var oRange=this.options.range,o=this.options,self=this,animate=(!this._animateOff)?o.animate:false,valPercent,_set={},lastValPercent,value,valueMin,valueMax;if(this.options.values&&this.options.values.length){this.handles.each(function(i,j){valPercent=(self.values(i)-self._valueMin())/(self._valueMax()-self._valueMin())*100;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";$(this).stop(1,1)[animate?"animate":"css"](_set,o.animate);if(self.options.range===true){if(self.orientation==="horizontal"){if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({left:valPercent+"%"},o.animate);}
if(i===1){self.range[animate?"animate":"css"]({width:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}else{if(i===0){self.range.stop(1,1)[animate?"animate":"css"]({bottom:(valPercent)+"%"},o.animate);}
if(i===1){self.range[animate?"animate":"css"]({height:(valPercent-lastValPercent)+"%"},{queue:false,duration:o.animate});}}}
lastValPercent=valPercent;});}else{value=this.value();valueMin=this._valueMin();valueMax=this._valueMax();valPercent=(valueMax!==valueMin)?(value-valueMin)/(valueMax-valueMin)*100:0;_set[self.orientation==="horizontal"?"left":"bottom"]=valPercent+"%";this.handle.stop(1,1)[animate?"animate":"css"](_set,o.animate);if(oRange==="min"&&this.orientation==="horizontal"){this.range.stop(1,1)[animate?"animate":"css"]({width:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="horizontal"){this.range[animate?"animate":"css"]({width:(100-valPercent)+"%"},{queue:false,duration:o.animate});}
if(oRange==="min"&&this.orientation==="vertical"){this.range.stop(1,1)[animate?"animate":"css"]({height:valPercent+"%"},o.animate);}
if(oRange==="max"&&this.orientation==="vertical"){this.range[animate?"animate":"css"]({height:(100-valPercent)+"%"},{queue:false,duration:o.animate});}}}});$.extend($.ui.slider,{version:"1.8.2"});}(jQuery));var ct1={};function namespace(packageName,packageBlock){var packageParts=packageName.split(".");var packageSoFar=this;for(var i=0;i<packageParts.length;i++){var packagePart=packageParts[i];if(!packageSoFar[packagePart]){packageSoFar[packagePart]={};}
packageSoFar=packageSoFar[packagePart];}
if(packageBlock){packageBlock(packageSoFar);}
return packageSoFar;}
ct1.createBindings=function(){var componentCount=0;var components=new Array();function execIf(func){if(func){func();}}
ct1.bindEarlyUXComponents=function(settings){execIf(ct1.lightboxBindings);for(var i=0;i<componentCount;i++){var f=components[i];if(typeof f=="function"){f();}}
var signIn=ct1.signIn();ct1.register(signIn);ct1.forgotPassword();ct1.activateYourAccount();ct1.navigation();ct1.ola.vrm();ct1.ola.navigation();ct1.ola.mmv();ct1.ola.watermark();ct1.ola.category();ct1.ola.vehicleDetails();ct1.ola.mediaUpload();ct1.ola.packageSelection();ct1.ola.standOutSelection();ct1.ola.advertPreview();ct1.ola.previewEdit();ct1.ola.checkout();ct1.ola.discount();ct1.ola.manageMyAds();if(!jQuery.fx.off){jQuery(document).bind("ct1.domChanged",function(){if(typeof ct1.commadverts.repositionBanner!="undefined")
ct1.commadverts.repositionBanner.repositionAll();});jQuery(window).bind("ajaxComplete",function(){if(typeof ct1.commadverts.repositionBanner!="undefined")
ct1.commadverts.repositionBanner.repositionAll();});jQuery(window).resize(function(){ct1.home.upgradeBrowser();if(typeof ct1.commadverts.repositionBanner!="undefined")
ct1.commadverts.repositionBanner.repositionAll();});}};ct1.addEarlyUXComponent=function(f){components[componentCount]=f;componentCount++;};}();ct1.fireDomChanged=function(){jQuery(document).trigger("ct1.domChanged");};jQuery(window).load(function(){ct1.fireDomChanged();});namespace("ct1.cms");ct1.cms.removeSearchCriterion=function(settings){var searchForm=jQuery("form[name=searchReviews]");var makeSpan=searchForm.find("span[class=remove-make]");var modelSpan=searchForm.find("span[class=remove-model]");var keywordAnchor=searchForm.find("a[class=remove-keywords]");var criterionName=settings.criterionName;var searchForm=jQuery("form[name=searchReviews]");if(criterionName=="keywords"){jQuery(".criteria .remove-keywords").remove();keywordAnchor.replaceWith("<input name=\"keywords\" value=\"e.g. Fuel Economy\" />");settings.reload=true;ct1.cms.initSearchForm(settings);}else if(criterionName=="make"){jQuery(".criteria .remove-make").remove();makeSpan.replaceWith("<select name=\"make\">"+"<option value=\"\">Manufacturer</option>"+"</select>");settings.criterionName="model";ct1.cms.removeSearchCriterion(settings);}else if(criterionName=="model"){jQuery(".criteria .remove-model").remove();modelSpan.replaceWith("<select name=\"model\">"+"<option value=\"\">All Models</option>"+"</select>");var modelSelectList=searchForm.find("select[name=model]");if(makeSpan.text().length<=0){modelSelectList.attr("disabled","disabled");}
ct1.cms.initSearchForm(settings);}
if($(".criteria span").length==0){jQuery(".criteria").empty();}}
ct1.cms.initThumbnailImages=function(){var $thumbnails=jQuery("img.thumbnailImage");var $mainImage=jQuery("img.reviewMainImage");var $mainImageCaption=jQuery("span.mainImageCaption");var mainImageWidth=null;function getImageWidth(imageUrl){return imageUrl.substring(imageUrl.lastIndexOf("/")+1);}
function getMainImageWidth(){if(mainImageWidth==null){mainImageWidth=getImageWidth($mainImage.attr("src"));}
return mainImageWidth;}
function setImageWidth(imageUrl,width){return imageUrl.substring(0,imageUrl.lastIndexOf("/")+1)+width;}
function replaceMainImageWithEnlargedThumbnail($thumbnailImage){$mainImage.attr("src",setImageWidth($thumbnailImage.attr("src"),getMainImageWidth()));$mainImageCaption.text($thumbnailImage.attr("id"));}
$thumbnails.each(function(){var $image=jQuery(this);$image.click(function(){replaceMainImageWithEnlargedThumbnail($image);});});};ct1.cms.initSearchForm=function(settings){var reload=settings.reload;var searchServerUrl=settings.searchServerUrl;var channel=ct1.search.criteria.toSeoName(settings.channel);var setMake=settings.make;var setModel=settings.model;var keywords=settings.keywords;var keywordDefault="e.g. Fuel Economy";var searchForm=jQuery("form[name=searchReviews]");var makeSelectList=searchForm.find("select[name=make]");var makeSpan=searchForm.find("span[class=remove-make]");var modelSelectList=searchForm.find("select[name=model]");var modelSpan=searchForm.find("span[class=remove-model]");var keywordText=searchForm.find("input[name=keywords]");var keywordAnchor=searchForm.find("a[class=remove-keywords]");init();function init(){resetModelOptions();initMakeSelectList();if(jQuery(".remove-make").length>0){initModelSelectList();}
initKeywordField();initSubmit();}
function toOmnitureName(value){return ct1.search.criteria.toSeoName(value).replace(/-/g,"_");}
function setOmnitureLinkName(make,model){var linkName=toOmnitureName(make);if(model){linkName+="_"+toOmnitureName(model);}
linkName+="_news_reviews_home";var trackingVar=searchForm.find("var.tracking");var trackingQueryString=trackingVar.attr("title");var trackingParams=trackingQueryString.split("|");var updatedTrackingQueryString="";for(var i=0;i<trackingParams.length;i++){if(trackingParams[i].startsWith("linkName=")){updatedTrackingQueryString+="linkName="+linkName;}else{updatedTrackingQueryString+=trackingParams[i];}
if(i+1<trackingParams.length){updatedTrackingQueryString+="|";}}
trackingVar.attr("title",updatedTrackingQueryString);}
function resetModelOptions(){var options=modelSelectList.find("option");for(var i=options.length-1;i>0;i--){jQuery(options[i]).remove();}}
function loadModelOptions(make){if(keywordAnchor.text().length>0){keywords=keywordAnchor.text();keywords=keywords.replace(" (remove)","");}else if(keywordText.val()!=keywordDefault&&keywordText.val()!=undefined){keywords=keywordText.val();}
jQuery.ajax({url:searchServerUrl+"/"+channel+"-news-reviews-model-refinements/"+
ct1.search.criteria.toSeoName(make)+"?keywords="+keywords,dataType:"json",type:"GET",cache:false,success:function(modelRefinements){resetModelOptions();var model;for(var i=0;i<modelRefinements.length;i++){model=modelRefinements[i];if(model!=null){var $option=jQuery("<option value='"+model.name+"' id='"+model.name+"'>"+
model.name+" ("+model.count+") </option>");modelSelectList.append($option);}}
modelSelectList.removeAttr("disabled");}});}
function loadMakeOptions(){if(keywordAnchor.text().length>0){keywords=keywordAnchor.text();keywords=keywords.replace(" (remove)","");}else if(keywordText.val()!=keywordDefault&&keywordText.val()!=undefined){keywords=keywordText.val();}
jQuery.ajax({url:searchServerUrl+"/"+channel+"-news-reviews-make-refinements?keywords="+keywords,dataType:"json",type:"GET",cache:false,success:function(makeRefinements){var make;makeSelectList=searchForm.find("select[name=make]");if(reload){makeSelectList=searchForm.find("select[name=make]");jQuery(makeSelectList.find("option")).remove();var $firstOption=jQuery("<option value='' id=''>Manufacturer</option>");makeSelectList.append($firstOption);}
for(var i=0;i<makeRefinements.length;i++){make=makeRefinements[i];if(make!=null){var $option=jQuery("<option value='"+make.name+"' id='"+make.name+"'>"+
make.name+" ("+make.count+") </option>");makeSelectList.append($option);}}}});}
function initMakeSelectList(){loadMakeOptions();jQuery(makeSelectList.find("option")[0]).attr("selected","selected");makeSelectList.change(function(){var selectedMakeOption=makeSelectList.find("option:selected");if(makeSelectList.find("option").index(selectedMakeOption)>0){var make=selectedMakeOption.val();setOmnitureLinkName(make);loadModelOptions(make);}else{modelSelectList.attr("disabled","disabled");resetModelOptions();}});}
function initModelSelectList(){loadModelOptions(makeSpan.text());modelSelectList.change(function(){var selectedMakeOption
if(makeSelectList.length>0){selectedMakeOption=makeSelectList.find("option:selected").val();}else{selectedMakeOption=makeSpan.text();}
var selectedModelOption=modelSelectList.find("option:selected").val();if(modelSelectList.find("option").index(selectedModelOption)>0){setOmnitureLinkName(selectedMakeOption,selectedModelOption);}else{setOmnitureLinkName(selectedMakeOption);}});}
function initKeywordField(){keywordText.focus(function(){if(keywordText.val()==keywordDefault){keywordText.val("");}});keywordText.blur(function(){if(keywordText.val()==""){keywordText.val(keywordDefault);}});}
function initSubmit(){jQuery("a.submit input").mousedown(function(){jQuery("a.submit input").addClass("searchRev");});jQuery("a.submit").mousedown(function(){jQuery("a.submit input").addClass("searchRev");});jQuery("body").mouseup(function(){jQuery(".searchRev").removeClass("searchRev");});searchForm.submit(function(){var makeSelectList=searchForm.find("select[name=make]");var makeSpan=searchForm.find("span[class=remove-make]");var modelSelectList=searchForm.find("select[name=model]");var modelSpan=searchForm.find("span[class=remove-model]");var keywordText=searchForm.find("input[name=keywords]");var keywordAnchor=searchForm.find("a[class=remove-keywords]");var selectedMakeOption=makeSelectList.find("option:selected");var keywords;var make;var selectedModelOption=modelSelectList.find("option:selected");var resultsUrl=searchServerUrl+"/"+channel+"-news-reviews";var model=selectedModelOption.val();if(selectedMakeOption.length>0){make=selectedMakeOption.val();}else{make=makeSpan.text();}
if(make.length>0){resultsUrl=resultsUrl+"/"+ct1.search.criteria.toSeoName(make);}
if(modelSelectList.find("option").index(selectedModelOption)>0){resultsUrl+="/"+ct1.search.criteria.toSeoName(model);}else if(modelSpan.text().length>0){var model=modelSpan.text();resultsUrl+="/"+ct1.search.criteria.toSeoName(model);}
if(keywordAnchor.length>0){keywords=keywordAnchor.text();}else if(keywordText.length>0){keywords=keywordText.val();}
if(keywords!=""&&keywords!=keywordDefault&&keywords!=undefined){keywords=keywords.replace(" (remove)","");resultsUrl+="?keywords="+keywords;}
window.location=resultsUrl;return false;});searchForm.keydown(function(event){if(event.keyCode=='13'){return searchForm.submit();}
return true;});searchForm.find("button.submit").click(function(){searchForm.submit();return false;});}};namespace("ct1.commadverts");ct1.commadverts.initBannerReposition=function(){ct1.commadverts.repositionBanner=new ct1.commadverts.RepositionBanner();ct1.commadverts.repositionBanner.repositionAll();};ct1.commadverts.initSearchResultsX01Reposition=function(){ct1.commadverts.repositionBanner=new ct1.commadverts.RepositionBanner();ct1.commadverts.repositionBanner.repositionOne("x01",".placeholderWideSky");}
ct1.commadverts.loadTakeoverIfCampaignRunning=function(){jQuery(window).load(function(){var $frame1Img=jQuery(".oasBannerFrame1").find("img:last");if($frame1Img.width()>1&&$frame1Img.height()>1){var $frame1Anchor=jQuery(".oasBannerFrame1").find("a");var $hptoIs;if($frame1Anchor.length==0){$hptoIs=$frame1Img;}else{$hptoIs=$frame1Anchor}
var $getWidth;var $frame1Img2=new Image();$frame1Img2.onload=function(){$getWidth=this.width/2;jQuery(".frame1").attr("style","margin-left:-"+$getWidth+"px;");}
$frame1Img2.src=$frame1Img.attr("src");jQuery(".frame1").append($hptoIs);}});};ct1.commadverts.RepositionBanner=function(){var bannerPositions={Top:[".placeholderTopLeaderboard"],Middle:[".homeMpuContainer",".searchMpuContainer",".mpuContainer",".mpu"],Right:[".placeholderWideSky"],Bottom:[".placeholderBottomLeaderboard",".leaderBanner"],BottomLeft:[".mpu"],BottomRight:[".mpu2"],Middle1:[".middle1"],x01:[".placeholderWideSky"],Position4:[".midSearch"]};this.repositionAll=function(){jQuery.each(bannerPositions,function(banner,placeHolders){for(var i=0;i<placeHolders.length;i++){repositionBanner(banner,placeHolders[i]);}});}
this.repositionOne=function(banner,placeHolder){repositionBanner(banner,placeHolder);}
function repositionBanner(banner,placeHolder){var p=jQuery(placeHolder);if(p.length<1)return;var b=jQuery(".oasBanner"+banner);if(b.length<1)return;resizeAndReposition(b,p);}
function reposition(banner,placeHolder){var left=(placeHolder.offset().left);var top=(placeHolder.offset().top);banner.css("left",left+"px");banner.css("top",top+"px");}
function resizeAndReposition(banner,placeHolder){reposition(banner,placeHolder);}};ct1.CookieHandler=function(){};ct1.UserService=function(userCookie){this.userCookie=userCookie;};ct1.UserService.prototype.getSignedInStatus=function(){return this.userCookie&&this.userCookie.isSignedIn()?"Yes":"No";};ct1.UserService.prototype.getUserId=function(){return this.userCookie?this.userCookie.getId():'';};ct1.UserService.prototype.getUserIdIfLoggedIn=function(){return this.userCookie&&this.userCookie.isSignedIn()?this.getUserId():'';};ct1.UserCookie=function(value){this.userData={};if(value!==null){this.userData=ct1.cookieValueParser.parse(value);}};ct1.UserCookie.prototype.getId=function(){return this.userData.USER_DB_ID;};ct1.UserCookie.prototype.getUserId=function(){return this.userData.ID;};ct1.UserCookie.prototype.isSignedIn=function(){return this.userData.USER_DB_ID&&this.userData.USER_DB_ID.length>0;};ct1.UserCookie.prototype.getTitle=function(){return this.userData.TITLE;};ct1.UserCookie.prototype.getFirstName=function(){return this.userData.FN;};ct1.UserCookie.prototype.getLastName=function(){return this.userData.LN;};ct1.UserCookie.prototype.getEmail=function(){var lastSignInEmail=jQuery('body').data('lastSignInEmail');return lastSignInEmail?lastSignInEmail:"";};ct1.cookieValueParser=function(){var that={};that.parse=function(value){var keyValues={};var elements=value.split("&");for(var i=0;i<elements.length;i++){var keyValue=elements[i].split('=');keyValues[keyValue[0]]=unescape(keyValue[1]);}
return keyValues;};that.format=function(multiValues){var formattedValue="";for(var i=0;i<multiValues.length;i++){var entry=multiValues[i];if(entry.value){if(formattedValue.length>0){formattedValue=formattedValue+"&";}
formattedValue=formattedValue+entry.key+"="+escape(entry.value);}}
return formattedValue;};return that;}();ct1.currentBrowser=function(){var that={};that.isIE6=function(){return(jQuery.browser.msie===true&&parseInt(jQuery.browser.version,10)<7);};that.isIE=function(){return jQuery.browser.msie===true;};that.isSafariOrChrome=function(){return jQuery.browser.safari===true;};return that;};ct1.initializeFinanceTabs=function(){function selectTab(index){var $selectedTab=jQuery(".modprod:eq("+index+")");$selectedTab.siblings(".modprod").removeClass("selected").hide();$selectedTab.addClass("selected").show();var $selectedTabButton=jQuery("ul.moditems li:eq("+index+")");$selectedTabButton.siblings().removeClass("selected");$selectedTabButton.addClass("selected");}
var $tabsUl=jQuery("ul.moditems");if($tabsUl.length>0){var classes=$tabsUl.attr("class").split(" ");var nameOfTabToSelect=classes[classes.length-1];var $selectedTabButton=$tabsUl.find("li."+nameOfTabToSelect);var indexOfSelectedTab;if($selectedTabButton.length>0){indexOfSelectedTab=Math.floor(Math.random()*$selectedTabButton.length);}else{indexOfSelectedTab=Math.floor(Math.random()*$tabsUl.find("li").length);}
selectTab(indexOfSelectedTab);jQuery(".moditems li").click(function(){selectTab(jQuery(this).index());return false;});}};jQuery(document).ready(function(){if(navigator.userAgent.indexOf('MSIE 8.')!="-1"){var thisCss;var clickedItem;function fixthis(fixItem){jQuery(fixItem).mousedown(function(){thisCss=jQuery(this).css("background-position-y").replace("px","");thisCss=parseInt(thisCss)+1;jQuery(this).css("background-position-y",thisCss+"px")
clickedItem=jQuery(this);thisCss=parseInt(thisCss)-1;}).mouseup(function(){clickedItem.css("background-position-y",thisCss+"px");});};fixthis("input.whiBut");fixthis(".newsReviewsSearch form span input");fixthis("span.whiBut button");fixthis("span.externalButton button");function moveBack(){if(clickedItem){clickedItem.css("background-position-y",thisCss+"px");}};jQuery("body").mouseup(function(){moveBack();});};});ct1.lightboxTools={loadContentForUrl:function(url,boxConfig,callback){var box=$.lightbox(boxConfig);if(typeof boxConfig.onBoxCreated=="function")boxConfig.onBoxCreated(box);jQuery.ajax({type:"GET",url:url,cache:false,complete:function(res){if(boxConfig.replace)
$(box).html(res.responseText);else
$(box).append(res.responseText);if(boxConfig.hideUntilLoaded)jQuery.lightbox.open();$('#lightbox .lightboxCompleteTrigger').trigger('lightbox-loaded');$("img.overlayMasterImage").trigger('lightbox-loaded');$("#lightbox input[type!='hidden']:first").focus();if(callback){callback();}}});},loadContent:function(link,boxConfig,callback){var url=link.attr('href');ct1.lightboxTools.loadContentForUrl(url,boxConfig,callback);},loadIFrameContent:function(link,boxConfig){var box=$.lightbox(boxConfig);var url="data='"+$(link).attr('href')+(boxConfig.params?"?"+boxConfig.params:"")+"'";var classid="classid='CLSID:25336920-03F9-11CF-8FD0-00AA00686F13'";var type="type='text/html'";var conf='style="width:100%;'+' height:'+(boxConfig.height+50)+'px;"';$(box).html("<div class='objectContainer'><object class='lightboxBanner'"+conf+" "+classid+" "+url+"><!--[if gte IE 7]><!--><object "+conf+" "+type+" "+url+"></object><!--><![endif]--></object></div>");$('#lightbox .lightboxCompleteTrigger').trigger('lightbox-loaded');},displayInLightBox:function(content,boxConfig){var box=$.lightbox(boxConfig);$(content).show();$(box).append(content);$('#lightbox .lightboxCompleteTrigger').trigger('lightbox-loaded');},displayInLightBoxExtended:function(content,boxConfig){var box=$.lightbox(boxConfig);$("#lightbox").addClass("darkBox");$(content).show();$(box).append(content);$('#lightbox .lightboxCompleteTrigger').trigger('lightbox-loaded');},close:function(){if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}}};ct1.lightboxBindings=function($){if(!$){$=jQuery;}
$('#lightbox').live('lightbox-closing',function(){if($('.setPageTrackingLightBox',this).length>0){$('.setPageTrackingLightBox',this).remove();ct1.trackingCleaner.clean({lightBoxClosing:true});ct1.all_pages.trackPage();}});function openLightbox(link){ct1.lightboxTools.loadContent(link,{height:300,width:300});}
function openDiscountOlaLightbox(link){var mycallback=function(){$('#discountAdvert.form').trigger('discount-ola-lightbox-loaded');};ct1.lightboxTools.loadContent(link,{height:200,width:690},mycallback);}
function openExpireOlaLightbox(link){ct1.lightboxTools.loadContent(link,{height:105,width:400});}
function openRebookOlaLightbox(link){ct1.lightboxTools.loadContent(link,{height:200,width:400});}
function openDeleteAdvertLightbox(link){ct1.lightboxTools.loadContent(link,{height:300,width:690});}
function openDeleteUserLightbox(link){var url=getEnhancedRegHref(link,'delete-user');ct1.lightboxTools.loadContentForUrl(url,{height:300,width:690});}
function openSignInLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxSignIn').trigger('sign-in-lightbox-loaded');};var url=getEnhancedRegHref(link,'sign-in');ct1.lightboxTools.loadContentForUrl(url,{height:375,width:690,hideUntilLoaded:true},mycallback);}
function openSignInToDetailsLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxSignInToDetails').trigger('sign-in-to-details-lightbox-loaded');};var url=getEnhancedRegHref(link,'sign-in-to-details');ct1.lightboxTools.loadContentForUrl(url,{height:375,width:690,hideUntilLoaded:true},mycallback);}
function openSignInOlaLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxSignInOla').trigger('sign-in-lightbox-loaded');};var url=getEnhancedRegHref(link,'sign-in');ct1.lightboxTools.loadContentForUrl(url,{height:375,width:690,hideUntilLoaded:true},mycallback);}
function openRegisterLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxRegister').trigger('register-lightbox-loaded');};var url=getEnhancedRegHref(link,'register');ct1.lightboxTools.loadContentForUrl(url,{height:750,width:690,hideUntilLoaded:true},mycallback);}
function openRegisterOlaLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxRegisterOla').trigger('register-lightbox-loaded');};var url=getEnhancedRegHref(link,'register');ct1.lightboxTools.loadContentForUrl(url,{height:750,width:690,hideUntilLoaded:true},mycallback);}
function openForgotPasswordLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxForgotPassword').trigger('forgot-password-lightbox-loaded');};var url=getEnhancedRegHref(link,'forgot-password');ct1.lightboxTools.loadContentForUrl(url,{height:375,width:690,hideUntilLoaded:true},mycallback);}
function openForgotPasswordOlaLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxForgotPasswordOla').trigger('forgot-password-lightbox-loaded');};var url=getEnhancedRegHref(link,'forgot-password');ct1.lightboxTools.loadContentForUrl(url,{height:375,width:690},mycallback);}
function openActivateYourAccountLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxActivateYourAccount').trigger('activate-your-account-lightbox-loaded');};var url=getEnhancedRegHref(link,'activate-your-account');ct1.lightboxTools.loadContentForUrl(url,{height:400,width:690},mycallback);}
function openActivateYourAccountOlaLightbox(link){var mycallback=function(){removeUnwantedVeils();$('.lightboxActivateYourAccount').trigger('activate-your-account-lightbox-loaded');};var url=getEnhancedRegHref(link,'activate-your-account');ct1.lightboxTools.loadContentForUrl(url,{height:400,width:690},mycallback);}
function openOlaVdPreviewLightbox(link){var mycallback=function(){$('.lightboxOlaVdPreview').trigger('ola-vd-preview-lightbox-loaded');};ct1.lightboxTools.loadContent(link,{height:620,width:760},mycallback);}
function openOlaPhotosPreviewLightbox(link){var mycallback=function(){$('.lightboxOlaPhotosPreview').trigger('ola-photos-preview-lightbox-loaded');};ct1.lightboxTools.loadContent(link,{height:620,width:1000},mycallback);}
function openOlaMagDescriptionLightbox(link,error){var mycallback=function(){$('.lightboxOlaMagDescription').trigger('ola-mag-description-lightbox-loaded');};var href=link.attr('href');if(error)link.attr('href',href+"&magTextLengthError=1");ct1.lightboxTools.loadContent(link,{height:580,width:760},mycallback);if(error)link.attr('href',href);}
function openUploadPhotosLightbox(link){ct1.lightboxTools.loadContent(link,{height:500,width:760});}
function openWideLightbox(link){ct1.lightboxTools.loadContent(link,{height:550,width:970});}
function openReportAdLightbox(link){ct1.lightboxTools.loadContent(link,{height:90,width:445});}
function openStandardLightbox(link){ct1.lightboxTools.loadContent(link,{height:580,width:760});}
function openSaveSearchLightbox(link){ct1.lightboxTools.loadContent(link,{height:500,width:730});}
function openWideIFrameLightbox(link){ct1.lightboxTools.loadIFrameContent(link,{height:550,width:970});}
function openPhotoLightbox(link){ct1.lightboxTools.loadContent(link,{height:560,width:780});}
function openVideoLightbox(link){ct1.lightboxTools.loadContent(link,{closeCallback:destroyFlash,height:390,width:780});}
function openProcessingLightbox(){ct1.lightboxTools.displayInLightBox($('#ola-lightbox-processing').html(),{height:200,width:600});}
function destroyFlash(){$('#flashcontent').html('');}
function getEnhancedRegHref(link,regPage){var regHref=link.attr('href');return regHref.replace(regPage,'reg/'+regPage);}
function removeLightbox(){if(jQuery('#lightbox').length>0){jQuery('#lightbox').remove();}}
function removeUnwantedVeils(){jQuery('div:hidden').remove('#veil');}
$('a.lightbox').live('click',function(e){e.preventDefault();openLightbox($(this));});$('a.readMore').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#readMoreContent').clone(),{height:210,width:780});});$('a.sellFeesUk').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellFeesUkContent').clone(),{height:210,width:780});});$('a.sellFeesNir').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellFeesNirContent').clone(),{height:210,width:780});});$('a.sellPageOne').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageOneContent').clone(),{height:400,width:780});});$('a.sellPageTwo').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageTwoContent').clone(),{height:500,width:780});});$('a.sellPageThree').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageThreeContent').clone(),{height:400,width:780});});$('a.sellPageFour').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageFourContent').clone(),{height:400,width:780});});$('a.sellPageFive').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageFiveContent').clone(),{height:400,width:780});});$('a.sellPageSix').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#sellPageSixContent').clone(),{height:400,width:780});});$('a.vehicleCheckReadMore').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCRead').clone(),{height:400,width:780});});$('a.vehicleCheckEnterReg').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCERContent').clone(),{height:400,width:780});});$('a.vehicleCheckEnterDetails').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCEDContent').clone(),{height:400,width:780});});$('a.vehicleCheckMultiCheck').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCMCContent').clone(),{height:400,width:780});});$('a.vehicleCheckPayment').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCCPContent').clone(),{height:400,width:780});});$('a.vehicleCheckReport').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#vCRContent').clone(),{height:400,width:780});});$('a.valuationVD').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#valuaVDContent').clone(),{height:400,width:780});});$('a.valuationCV').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#valuaCVContent').clone(),{height:400,width:780});});$('a.valuationAVO').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#valuaAVOContent').clone(),{height:400,width:780});});$('a.valuationVMC').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#valuaVMCContent').clone(),{height:400,width:780});});$('a.valuationVR').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#valuaVRContent').clone(),{height:400,width:780});});$('a.insuranceYD').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#insuranceYDContent').clone(),{height:400,width:780});});$('a.insuranceVD').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#insuranceVDContent').clone(),{height:400,width:780});});$('a.insuranceYQ').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#insuranceYQContent').clone(),{height:400,width:780});});$('a.insuranceBP').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#insuranceBPContent').clone(),{height:400,width:780});});$('a.lightboxSignIn').live('click',function(e){e.preventDefault();removeLightbox();openSignInLightbox($(this));});$('a.lightboxSignInToDetails').live('click',function(e){e.preventDefault();removeLightbox();openSignInToDetailsLightbox($(this));});$('a.lightboxSignInOla').live('click',function(e){e.preventDefault();removeLightbox();openSignInOlaLightbox($(this));});$('a.lightboxForgotPassword').live('click',function(e){e.preventDefault();removeLightbox();openForgotPasswordLightbox($(this));});$('a.lightboxForgotPasswordOla').live('click',function(e){e.preventDefault();removeLightbox();openForgotPasswordOlaLightbox($(this));});$('a.lightboxActivateYourAccount').live('click',function(e){e.preventDefault();removeLightbox();openActivateYourAccountLightbox($(this));});$('a.lightboxActivateYourAccountOla').live('click',function(e){e.preventDefault();removeLightbox();openActivateYourAccountOlaLightbox($(this));});$('a.lightboxRegister').live('click',function(e){e.preventDefault();removeLightbox();openRegisterLightbox($(this));});$('a.lightboxRegisterOla').live('click',function(e){e.preventDefault();removeLightbox();openRegisterOlaLightbox($(this));});$('a.lightboxDeleteUser').live('click',function(e){e.preventDefault();openDeleteUserLightbox($(this));});$('a.lightboxDiscountOla').live('click',function(e){e.preventDefault();openDiscountOlaLightbox($(this));});$('a.lightboxExpireOla').live('click',function(e){e.preventDefault();openExpireOlaLightbox($(this));});$('a.lightboxDeleteAdvert').live('click',function(e){e.preventDefault();openDeleteAdvertLightbox($(this));});$('a.lightboxRebookOla').live('click',function(e){e.preventDefault();openRebookOlaLightbox($(this));});$('a.lightboxUploadPhotos').live('click',function(e){e.preventDefault();var link=addImageCount(this);openUploadPhotosLightbox(link);});$('.lightboxUploadPhotosPreview').live('go-click',function(e){e.preventDefault();var link=addImageCount(this);jQuery.lightbox.close();openUploadPhotosLightbox(link);});$('.helpSec a').live('click',function(e){e.preventDefault();link=jQuery(this);if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.loadContent(link,{height:105,width:780});});function addImageCount(hrefLink){var link=$(hrefLink);if(link.data("oldHref")==null)
link.data("oldHref",link.attr("href"));else
link.attr("href",link.data("oldHref"));var href=link.attr("href");href+="&count="+$("#o_mu_sortable li img").length;link.attr("href",href);return link;}
$('a.lightboxWide').click(function(e){e.preventDefault();openWideLightbox($(this));});$('a.lightboxReportAd').click(function(e){e.preventDefault();openReportAdLightbox($(this));});$('a.lightboxStandard').click(function(e){e.preventDefault();openStandardLightbox($(this));});$('a.lightboxOlaVdPreview').click(function(e){e.preventDefault();openOlaVdPreviewLightbox($(this));});$('a.lightboxOlaPhotosPreview').click(function(e){e.preventDefault();loadPhotoPreview(this);});$('a.lightboxOlaPhotosPreview').bind('auto-click',function(e){loadPhotoPreview(this);});function loadPhotoPreview(editPhotosLink){if(ct1.utilities.hasFormChanged('#olaAdvertPreview')){openProcessingLightbox();var frm=$('#olaAdvertPreview');$('input[name=editPhotos]',frm).val(1);$('button[value=Continue]',frm).click();}
else{openOlaPhotosPreviewLightbox($(editPhotosLink));}}
$('a.lightboxOlaMagDescription').click(function(e){e.preventDefault();openOlaMagDescriptionLightbox($(this),false);});$('a.lightboxOlaMagDescription').live("mag-length-error",function(e){openOlaMagDescriptionLightbox($(this),true);});$('a.lightboxSaveSearch').live("click",function(e){e.preventDefault();openSaveSearchLightbox($(this));});$('a.lightboxWideIFrame').click(function(e){e.preventDefault();openWideIFrameLightbox($(this));});$('a.lightboxPhoto').click(function(e){e.preventDefault();var href=$(this).attr('href');ct1.lightboxTools.displayInLightBox('<img src="'+href+'" />',{height:500,width:660});});$('a.lightboxDirections').click(function(e){e.preventDefault();var href=$(this).attr('href');ct1.lightboxTools.loadIFrameContent(this,{width:970,height:500});});$('a.lightboxLocationChange').click(function(e){e.preventDefault();var href=$(this).attr('href');ct1.lightboxTools.displayInLightBox($('.distanceWidgetFormContainer').html(),{height:200,width:250});$('#lightbox').find(".townBox").distanceWidget(null);});$('a.lightboxEmailSeller').live('click',function(e){if($("#lightbox").length>0){$.lightbox.close();}
e.preventDefault();ct1.search.advert.performRedirectLoggedAction(this,'advertEmailSellerButton');ct1.lightboxTools.loadContent($(this),{height:545,width:490,hideUntilLoaded:true},function(){ct1.search.advert.bindEmailSubmit();ct1.search.advert.bindKaptchaImage();});$("#subSection4").attr("title",$("#subSection3").attr("title"));$("#subSection4").attr("title",$("#subSection4").attr("title")+":email_seller");$("#pageName").attr("title",$("#subSection4").attr("title"));ct1.all_pages.trackPage();});$('a.lightboxPhotoGallery').live('click',function(e){e.preventDefault();var galleryContent=$(".lightboxPhotoGalleryContent");var largerImages=galleryContent.hasClass('largerImages');var html=galleryContent.clone();html.removeClass('hidden');$('script',html).remove();if($('.lightboxPhotoGalleryContent ').hasClass('.advantageGallery')){ct1.lightboxTools.displayInLightBox(html,{height:largerImages?751:518,width:largerImages?1024:780});}else{ct1.lightboxTools.displayInLightBoxExtended(html,{height:largerImages?751:518,width:largerImages?1024:940});}
ct1.search.advert.media.photoGallery(this,largerImages);});$('.overlayThumbnailLink').live('click',function(){$("#subSection4").attr("title",$("#subSection3").attr("title"));$("#subSection4").attr("title",$("#subSection4").attr("title")+":"+$(this).attr("id"));$("#pageName").attr("title",$("#subSection4").attr("title"));ct1.all_pages.trackPage();});$('a.lightboxVideoSlideShow').click(function(e){e.preventDefault();var videoContent=$(".lightboxVideoSlideShowContent");var html=videoContent.clone();html.removeClass('hidden');$('script',html).remove();ct1.lightboxTools.displayInLightBox(html,{closeCallback:function(){$('#lightbox .lightboxVideoSlideShowContent').html('');},height:520,width:530});$('#lightbox .videoSlideShowContent').videoSlideShow($(this).data('settings'));});$('div.lightbox > img').click(function(e){var parent=$(this).parent();ct1.lightboxTools.displayInLightBox($(parent).find("div").clone(),{height:340,width:780});});$('a.searchHelpBox').live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
ct1.lightboxTools.displayInLightBox($('#searchHelpBox').clone(),{height:400,width:480});});if(window.location.href.match(/#photoLink/)){$('#photoLink').click();}else if(window.location.href.match(/#videoSlideShow/)){openVideoLightbox($('#videoSlideShow'));}else if(window.location.href.match(/#videoPlayer/)){openVideoLightbox($('#videoPlayer'));}};function closeAtOverlay(){$('a.closeIcon').click();}
namespace("ct1.navigation");ct1.navigation=function(){function initNavigation(){if(jQuery(".mainNav").length<1){return;}
if(jQuery.browser.msie&&jQuery.browser.version<7){jQuery("body").addClass("isIE6");jQuery(".isIE6 .dropdown").hover(function(){var $this=jQuery(this).find(".subMenu");jQuery(this).hover(function(){$this.css({"display":"block","width":"250px"});},function(){$this.css("display","none");})});}
jQuery(".dropdown a").click(function(e){if($(this).hasClass("noLink")&&!(navigator.platform.indexOf("iPod")!=-1)){e.preventDefault();}});}
initNavigation();};namespace("ct1.oas");ct1.oas.QueryString=function(settings){this.jsonSearchCriteria=settings.searchCriteria;this.channel=settings.channel;this.locationName=settings.locationName;this.postcode=settings.postcode;this.keywords=settings.keywords;this.build=function(){var queryParams={};var dealerId=$('body').attr('data-dealer-id');if(dealerId){queryParams['DID']=dealerId;}
if(this.jsonSearchCriteria&&this.jsonSearchCriteria.length>0){var searchCriteria=ct1.search.criteria.SearchCriteria.fromJson(this.jsonSearchCriteria);var makeModelDims;if(this.channel=='Leisure'||this.channel=='Plant'||this.channel=='Farm'){makeModelDims=searchCriteria.getCriteriaByDimensionName('Make');for(var i=0;i<makeModelDims.length;i++){queryParams['MAKE|'+i]=this.convertSpace(makeModelDims[i].getValue());}}else{makeModelDims=searchCriteria.getCriteriaByDimensionName('MakeModel');for(var i=0;i<makeModelDims.length;i++){queryParams['MAKE|'+i]=this.convertSpace(makeModelDims[i].getParentValue());for(var m=0;m<makeModelDims[i].getChildValues().length;m++){queryParams['MODEL|'+i+'_'+m]=this.convertSpace(makeModelDims[i].getChildValues()[m]);}}}
var bodyTypeDims=searchCriteria.getCriteriaByDimensionName('BodyType');for(var i=0;i<bodyTypeDims.length;i++){queryParams['BODY|'+i]=this.convertSpace(bodyTypeDims[i].getValue());}
var yearDimName='Year'
if(this.channel=='Car')yearDimName='CarYearRangesZar';else
yearDimName='YearRanges';var yearDims=searchCriteria.getCriteriaByDimensionName(yearDimName);for(var i=0;i<yearDims.length;i++){queryParams['YEAR|'+i]=this.convertSpace(yearDims[i].getValue());}
var mileageDimName='Mileage';if(this.channel=='Bike'||this.channel=='Car')mileageDimName='BikeAndCarMileageRanges';else if(this.channel=='Commercial')mileageDimName='CommercialMileageRanges';var mileageDims=searchCriteria.getCriteriaByDimensionName(mileageDimName);for(var i=0;i<mileageDims.length;i++){queryParams['MILEAGE|'+i]=this.convertSpace(mileageDims[i].getValue());queryParams['MILEAGE|'+i]=queryParams['MILEAGE|'+i].replace(new RegExp(",","g"),"");}
var engineCapacityDimName='EngineCapacity';if(this.channel=='Car')engineCapacityDimName='CarEngineCapacityRanges';else if(this.channel=='Bike')engineCapacityDimName='BikeEngineCapacityRanges';var engineCapacityDims=searchCriteria.getCriteriaByDimensionName(engineCapacityDimName);for(var i=0;i<engineCapacityDims.length;i++){queryParams['ENGINE|'+i]=this.convertSpace(engineCapacityDims[i].getValue());}
var fuelTypeDims=searchCriteria.getCriteriaByDimensionName('FuelType');for(var i=0;i<fuelTypeDims.length;i++){queryParams['FUEL|'+i]=this.convertSpace(fuelTypeDims[i].getValue());}
var transmissionDims=searchCriteria.getCriteriaByDimensionName('TransmissionType');for(var i=0;i<transmissionDims.length;i++){queryParams['TRANS|'+i]=this.convertSpace(transmissionDims[i].getValue());}
var sellerTypeDims=searchCriteria.getCriteriaByDimensionName('SellerType');for(var i=0;i<sellerTypeDims.length;i++){queryParams['SELLER|'+i]=this.convertSpace(sellerTypeDims[i].getValue());}
if(this.keywords!="")queryParams['KEYWORD']=this.convertSpace(this.keywords);var distanceDim=searchCriteria.getGeoSearchCriterion();var distance=distanceDim?distanceDim.getRadius():null;queryParams['DIST']=this.convertDistance(distance);if(this.locationName!="")queryParams['LOC']=this.convertSpace(this.locationName);var priceDimName='Price';if(this.channel=='Commercial'||this.channel=='Car')priceDimName='CarAndCommercialPriceRangesZar';else if(this.channel=='Bike')priceDimName='BikePriceRangesZar';else if(this.channel=='Leisure')priceDimName='LeisurePriceRangesZar';else if(this.channel=='Plant'||this.channel=='Farm')priceDimName='FarmAndPlantPriceRangesZar';var pricesDims=searchCriteria.getCriteriaByDimensionName(priceDimName);queryParams['MIN']=pricesDims.length>0?getMinPriceValue(pricesDims):null;queryParams['MAX']=pricesDims.length>0?getMaxPriceValue(pricesDims):null;}
else{if(this.postcode&&this.postcode.length>0){queryParams['LOC']=this.convertSpace(this.postcode);}}
return this.createQueryString(queryParams,this.channel);}
getMinPriceValue=function(pricesDims){var minPriceStr=2000001;jQuery.each(pricesDims,function(index,value){var priceStr=value.getValue();if(!priceStr.contains("Under")&&!priceStr.contains("Above")){priceStr=priceStr.substring(0,priceStr.indexOf(" "));priceStr=Number(priceStr.replace(new RegExp(",","g"),""));if(priceStr!=NaN&&priceStr<minPriceStr){minPriceStr=priceStr;}}else if(priceStr.contains("Above")){priceStr=priceStr.substring(priceStr.indexOf(" ")+1,priceStr.length);priceStr=Number(priceStr.replace(new RegExp(",","g"),""));if(priceStr!=NaN&&priceStr<minPriceStr){minPriceStr=priceStr;}}else{minPriceStr=0;}});return minPriceStr;}
getMaxPriceValue=function(pricesDims){var maxPriceStr=0;jQuery.each(pricesDims,function(index,value){var priceStr=value.getValue();if(!priceStr.contains("Above")&&maxPriceStr!=null){priceStr=priceStr.substring(priceStr.lastIndexOf(" ")+1,priceStr.length);priceStr=Number(priceStr.replace(new RegExp(",","g"),""));if(priceStr!=NaN&&priceStr>maxPriceStr){maxPriceStr=priceStr;}}else{maxPriceStr=null}});return maxPriceStr;}
this.createQueryString=function(queryParams,channel){var queryString='';jQuery.each(queryParams,function(key,value){var paramName=key;var idx=key.lastIndexOf('|');if(idx>0)paramName=key.substr(0,idx);paramName=channel+'_'+paramName;if(value){if(typeof value==="string")value=value.toLowerCase();queryString+=paramName.toUpperCase()+'='+encodeURIComponent(value)+'&';}});return queryString.length>0?queryString.substring(0,queryString.length-1):'';}
this.convertAge=function(year){var currentYear=new Date().getFullYear();return!year?'':currentYear-year+1;}
this.convertDistance=function(distance){return!distance?1501:distance;}
this.convertMileage=function(mileageMax){if(!mileageMax)return'';var m=101;if(mileageMax<=5000)m=5;else if(mileageMax<=10000)m=10;else if(mileageMax<=20000)m=20;else if(mileageMax<=40000)m=40;else if(mileageMax<=60000)m=60;else if(mileageMax<=80000)m=80;else if(mileageMax<=100000)m=100;return m;}
this.convertSpace=function(str){return str.replace(/ /g,'_');};}
namespace("ct1.utilities");ct1.utilities.addFormField=function(formOrSelector,config){var form=$(formOrSelector);if(form.length==0)return;var fieldType="hidden";if(typeof config.type!="undefined")fieldType=config.type;var idx="";if(config.autoList==true){var count=form.data(config.name+"count");if(count==null)count=0;idx="["+count+"]";$(form).data(config.name+"count",++count);}
var field=$("input[name='"+config.name+idx+"']",form);if(field.length==0){field=$("<input/>").attr("name",config.name+idx).attr("type",fieldType);$(form).append(field);}
field.val(config.value);}
ct1.utilities.formatNumber=function(number){if(typeof number!="string"){number+="";}
var parts=number.split(".");var integralPart=parts[0];var fractionalPart=parts.length>1?"."+parts[1]:"";var rgx=/(\d+)(\d{3})/;while(rgx.test(integralPart)){integralPart=integralPart.replace(rgx,"$1"+","+"$2");}
return integralPart+fractionalPart;};ct1.utilities.parseFormattedNumber=function(string){return parseInt(string.replace(/,/g,""));};ct1.utilities.isNotBlank=function(string){return string!=null&&string.trim()!="";};ct1.utilities.isBlank=function(string){return!ct1.utilities.isNotBlank(string);};ct1.utilities._trackedForms={};ct1.utilities.trackFormChanges=function(id,form){var frm=!form?$(id):$(form);if(frm.length===0)return;ct1.utilities._trackedForms[id]=frm.serialize();};ct1.utilities.hasFormChanged=function(id,form){if(!ct1.utilities._trackedForms[id])return false;var frm=!form?$(id):$(form);return ct1.utilities._trackedForms[id]!=frm.serialize();};ct1.utilities.newInfoWindow=function(url,name,width,height,features){if(!features){features="scrollbars=no,menubar=no,status=no,toolbar=no,resizable=no";};var newInfoWindow=eval('window.open(url,name,"width='+width+'px,height='+height+'px,'+features+'")');return false;};ct1.utilities.getParameter=function(url,parameterName){var parameterValue=null;if(ct1.utilities.isNotBlank(url)&&ct1.utilities.isNotBlank(parameterName)){var indexOfParameterName=url.indexOf(parameterName+"=");if(indexOfParameterName>=0){var indexOfParameterValue=indexOfParameterName+parameterName.length+1;var indexOfParameterValueEnd=url.indexOf("&",indexOfParameterValue);if(indexOfParameterValueEnd<indexOfParameterValue){indexOfParameterValueEnd=url.length;}
parameterValue=url.substring(indexOfParameterValue,indexOfParameterValueEnd);}}
return parameterValue;};String.prototype.trim=function(){return this.replace(/^\s*/,"").replace(/\s*$/,"");};String.prototype.startsWith=function(str){return this.match("^"+str)==str;};String.prototype.endsWith=function(str){return this.length>=str.length&&this.lastIndexOf(str)==(this.length-str.length);};String.prototype.equalsIgnoreCase=function(str){return str!=null&&(this==str||this.toLowerCase()==str.toLowerCase());};String.prototype.containsIgnoreCase=function(str){return this.toLowerCase().indexOf(str.toLowerCase())>=0;};String.prototype.contains=function(str){return this.indexOf(str)>=0;};namespace("ct1.watchlist");ct1.watchlist.init=function(settings){ct1.watchlist.initNumberOfAdvertsPerPageWidget(settings);};ct1.watchlist.initNumberOfAdvertsPerPageWidget=function(settings){jQuery("select[name=numberOfAdvertsPerPage]").change(function(){window.location=settings.searchServerUrl+"/watchlist?numberOfAdvertsPerPage="+this.value;return false;});};(function($){function getMessage(charLength){return charLength===1?" character remaining":" characters remaining";}
function getNewLength(charLength,maxLength){return maxLength-charLength;}
$.fn.extend({counter:function(optionalMaxLength,errorStateFunction){var maxLength=optionalMaxLength!==undefined?optionalMaxLength:10;return this.each(function(){var $obj=$(this);var newLength=getNewLength($($obj).val().length,maxLength);var msg=getMessage(newLength);$('<div id=\"'+this.id+'_counter\" class=\"characterCountDisplay\" style=\"float:right; color:#666;\">'+'<span id=\"webCharsRemaining\" style=\"color:#3E3596; font-family:Georgia,Times New Roman,Times,serif;\">'+
newLength+'</span>'+msg+'</div>').insertBefore($obj);if(errorStateFunction){var inError=newLength<0;errorStateFunction(inError);}
var $currentCount=$(".characterCountDisplay span");$obj.bind('keyup click blur focus change paste',function(){var newLength=getNewLength($($obj).val().length,maxLength);$currentCount.text(newLength);if(errorStateFunction){var inError=newLength<0;errorStateFunction(inError);}});});}});})
(jQuery);(function($){jQuery.fn.jsTemplate=function(){var $this=this;function parseTemplate(){var str=$this.html().trim();if(str.startsWith("<!--")){str=str.substring("<!--".length);if(str.endsWith("//-->")){str=str.substring(0,str.length-"//-->".length);}else if(str.endsWith("-->")){str=str.substring(0,str.length-"-->".length);}}
var strFunc="var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+
str.replace(/[\r\t\n]/g," ").replace(/'(?=[^#]*#>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g,"',$1,'").split("<#").join("');").split("#>").join("p.push('")+"');}return p.join('');";return new Function("obj",strFunc);}
var compiledTemplate=parseTemplate();this.toHtml=function(data){return compiledTemplate(data);};return this;};})(jQuery);try{document.execCommand("BackgroundImageCache",false,true);}catch(err){}
(function($){var defaults={closeCallback:function(){},width:500,isFixedPosition:true,hideUntilLoaded:false,closeOnVeilClick:true,closeButton:true};var options=null;$.lightbox=function(optionsOverride,callback){var box=init(optionsOverride);var content=$(box).find(".lbContent");if(callback!==undefined){callback(content);}
return content;};function init(optionsOverride){options=$.extend({},defaults,optionsOverride);var id=create();positionLightbox();if(!options.hideUntilLoaded)open();return id;}
function create(){var veil=$('<div id="veil" style="display:none;"></div>');$('body').append(veil);if(options.closeOnVeilClick){veil.click(function(){close();});}
var box=$('<div id="lightbox" class="pngBg" style="display:none;">'+'<div class="lbContainer">'+'<div class="lbContent"></div>'+'</div>'+'</div>');$('body').append(box);if(options.closeButton){var closeButton=$('<a href="#" class="close closeIcon pngBg" ><span>Close</span></a>');box.append(closeButton);closeButton.click(function(e){e.preventDefault();close();});}
return box;}
function destroy(){$("#lightbox *").unbind();$("#lightbox").remove();$("#veil").unbind().remove();return false;}
function getCurrentWindowState(){return{wHeight:$(window).height(),wWidth:$(window).width(),scrollTop:(ct1.currentBrowser().isSafariOrChrome())?($("body").scrollTop()):($("html").scrollTop()),scrollLeft:(ct1.currentBrowser().isSafariOrChrome())?($("body").scrollLeft()):($("html").scrollLeft())};}
function positionLightbox(){var currentWindowState=getCurrentWindowState();var lightboxLeft=(currentWindowState.wWidth-options.width)/2;var lightboxTop=(currentWindowState.wHeight-options.height)/2;var boxDetails={left:lightboxLeft+currentWindowState.scrollLeft-12,top:(options.isFixedPosition?60:lightboxTop)+currentWindowState.scrollTop,width:currentWindowState.wWidth-(lightboxLeft*2)};$("#lightbox").css(boxDetails);return false;}
function showVeil(){$("#veil").css({display:'block',opacity:0.6});}
function hideVeil(){$("#veil").css({display:'none'});}
function showLightbox(){$("#lightbox").css({display:'block'});}
function hideLightbox(){$("#lightbox").css({display:'none'});}
function open(){if(ct1.currentBrowser().isIE6()){$("select:visible").addClass("ie-lightbox-hidden");}
hideObjects();showVeil();showLightbox();}
function close(callback){hideLightbox();hideVeil();showObjects();var cb=callback||options.closeCallback;cb();$('#lightbox').trigger('lightbox-closing');destroy();if(ct1.currentBrowser().isIE6()){$("select").removeClass("ie-lightbox-hidden");}
ct1.fireDomChanged();}
function hideObjects(){$('iframe, embed, object').addClass("hiddenByLightBox");}
function showObjects(){$('iframe, embed, object').removeClass("hiddenByLightBox");}
$.lightbox.close=function(callback){close(callback);};$.lightbox.open=function(){open();};$.lightbox.resizeAndCentre=function(newWidth,newHeight){var lightbox=$("#lightbox");var oldHeight=lightbox.height();var oldWidth=lightbox.width();var oldLeft=lightbox.position().left;var oldTop=lightbox.position().top;var newTop=oldTop-(newHeight-oldHeight)/2;var newLeft=oldLeft-(newWidth-oldWidth)/2;lightbox.css({width:newWidth,height:newHeight,top:newTop,left:newLeft});};})(jQuery);(function(jQuery){var openTimeout=300;var closeTimeout=150;var isIE6=jQuery.browser.msie&&(parseInt(jQuery.browser.version,10)<7);function tooltip(target_items,name){jQuery(target_items).each(function(i){var that=jQuery(this);var namei=name+i;jQuery("body").append("<div class='"+name+"' id='"+namei+"'><p>"+that.attr('title')+"</p><p class='tooltipBottom'></p></div>");var auto_tooltip=jQuery("#"+namei);var height=jQuery("#"+name+i+"> p").height();var openID,closeID,open=false;that.removeAttr("title").mouseenter(function(){if(closeID){window.clearTimeout(closeID);closeID=null;}
if(!open&&!openID){openID=window.setTimeout(function(){open=true;openID=null;if(isIE6){auto_tooltip.show();}else{auto_tooltip.fadeIn(300);}},openTimeout);}}).mouseleave(function(){if(openID){window.clearTimeout(openID);openID=null;}
if(open&&!closeID){closeID=window.setTimeout(function(){open=false;if(isIE6){auto_tooltip.hide();}else{auto_tooltip.fadeOut(200);}
closeID=null;},closeTimeout);}}).mousemove(function(kmouse){var pos=that.offset();auto_tooltip.css({"left":(pos.left+0)+"px","top":(pos.top-height-32)+"px"});}).click(function(e){e.preventDefault();auto_tooltip.fadeIn(300);});auto_tooltip.css({display:"none"});});}
jQuery(document).ready(function(){tooltip("a._tooltip","tooltip");});})(jQuery);(function($){var count=0;function getPreserveWidth($this){var preserveWidth=0;var $preserve=$this.children(".preserve");var preserveText=getPreserveText($this);if(preserveText!==''){var $preserveTable=$preserve.html("<table><tr><td>"+preserveText+"</td></tr></table>");var $td=jQuery("td",$preserveTable);preserveWidth=$td.width();$preserve.html(preserveText);}
return preserveWidth;}
function getPreserveText($this){var preserveText=$this.children(".preserve").text();return preserveText===null?'':preserveText;}
jQuery.fn.truncate=function(width){return this.each(function(){var $this=jQuery(this);var text=$this.text();var fullText=text.trim();var preserveText=getPreserveText($this);var preserveWidth=getPreserveWidth($this);if(preserveText!==''){text=text.substring(0,text.indexOf(preserveText));}
var targetWidth;if(width){targetWidth=width;}else{targetWidth=$this.css("width");}
if(targetWidth==null||targetWidth=="auto"){targetWidth=$this.parent().css("width");}
if(targetWidth!=null&&targetWidth.endsWith("px")){targetWidth=parseInt(targetWidth)-preserveWidth;$this.html("<table><tr><td>"+text+"</td></tr></table>");var $td=jQuery("td",$this);if($td.width()>targetWidth){while($td.width()>targetWidth&&text.length>0){text=text.substring(0,text.length-1);$td.text(text+"...");}
if(text.length===0){$td.text(fullText);}else{$this.html($td.text()+preserveText);$this.attr("title",fullText);}}else{$this.html(text+preserveText);}}});};})(jQuery);namespace("ct1.dealer.criteria");ct1.dealer.criteria.toSeoName=function(name){name=name.toLowerCase();var seoName="";var c;for(var i=0;i<name.length;i++){c=name.charAt(i);if((c>="a"&&c<="z")||(c>="0"&&c<="9")){seoName+=c;}else if(c=="&"){seoName+="and";}else if(i>0&&seoName.charAt(seoName.length-1)!="-"){seoName+="-";}}
if(seoName.length==0){seoName="-";}else{while(seoName.charAt(seoName.length-1)=="-"){seoName=seoName.substring(0,seoName.length-1);}}
return seoName;};ct1.dealer.criteria.SearchCriteria=function(){var criteria=[];var afterAddCriterion;var afterRemoveCriterion;function isContainsCriterion(criterion){for(var i=0;i<criteria.length;i++){if(criteria[i].equals(criterion)){return true;}}
return false;}
function isKeywordCriterion(criterion){return typeof criterion.getTerms=="function";}
this.addCriterion=function(criterion){if(!isContainsCriterion(criterion)){criteria[criteria.length]=criterion;if(afterAddCriterion){afterAddCriterion();}}};this.afterAddCriterion=function(aftrAddCriterion){afterAddCriterion=aftrAddCriterion;};this.removeCriterion=function(criterion){var newCriteria=[];for(var i=0;i<criteria.length;i++){if(!criteria[i].equals(criterion)){newCriteria[newCriteria.length]=criteria[i];}}
if(criteria.length!=newCriteria.length){criteria=newCriteria;if(afterRemoveCriterion){afterRemoveCriterion();}}};this.removeAllCriteria=function(){criteria=[];};this.afterRemoveCriterion=function(aftrRemoveCriterion){afterRemoveCriterion=aftrRemoveCriterion;};this.getCriteriaByDimensionName=function(dimensionName){var dimensionCriteria=[];for(var i=0;i<criteria.length;i++){if(typeof criteria[i].getDimensionName=="function"&&criteria[i].getDimensionName()==dimensionName){dimensionCriteria[dimensionCriteria.length]=criteria[i];}}
return dimensionCriteria;};this.getGeoSearchCriterion=function(){for(var i=0;i<criteria.length;i++){if(typeof criteria[i].getRadius=="function"){return criteria[i];}}};this.toSearchUrl=function(options){var url=options.dealerServerUrl;var keywordCriterion=null;for(var i=0;i<criteria.length;i++){if(isKeywordCriterion(criteria[i])){keywordCriterion=criteria[i];}else{url+=criteria[i].toUrlPathParameter();}}
url+=options.searchPath;var queryString="";if(keywordCriterion!=null){queryString="keywords="+keywordCriterion.getTerms();}
if(options.params){for(var name in options.params){if(options.params[name]!=null){if(queryString.length>0){queryString+="&";}
queryString+=name+"="+encodeURIComponent(options.params[name]);}}}
var location=ct1.location.UserLocationManager.getInstance().getUserLocation();if(location!=null){if(queryString.length>0){queryString+="&";}
queryString+=location.toQueryStringParameters();}
if(queryString.length>0){url+="?"+queryString;}
return url;};this.toDealerSearchUrl=function(options){var url=options.dealerServerUrl;var keywordCriterion=null;for(var i=0;i<criteria.length;i++){if(isKeywordCriterion(criteria[i])){keywordCriterion=criteria[i];}else{url+=criteria[i].toUrlPathParameter();}}
url+=options.searchPath;var queryString="";if(keywordCriterion!=null){queryString="keywords="+keywordCriterion.getTerms();}
if(options.params){for(var name in options.params){if(options.params[name]!=null){if(queryString.length>0){queryString+="&";}
queryString+=name+"="+encodeURIComponent(options.params[name]);}}}
var location=ct1.location.UserLocationManager.getInstance().getUserLocation();if(location!=null){if(queryString.length>0){queryString+="&";}
queryString+=location.toQueryStringParameters();}
if(queryString.length>0){url+="?"+queryString;}
return url;};this.equals=function(searchCriteria){var equals=false;var otherCriteria=searchCriteria.getCriteria();if(criteria.length==otherCriteria.length){for(var i=0;i<otherCriteria.length;i++){if(!isContainsCriterion(otherCriteria[i])){return false;}}
equals=true;}
return equals;};this.getCriteria=function(){return criteria;};this.clone=function(){var clone=new ct1.dealer.criteria.SearchCriteria();for(var i=0;i<criteria.length;i++){clone.addCriterion(criteria[i].clone());}
clone.afterAddCriterion(afterAddCriterion);clone.afterRemoveCriterion(afterRemoveCriterion);return clone;};};ct1.dealer.criteria.SearchCriteria.fromJson=function(jsonCriteria){var searchCriteria=new ct1.dealer.criteria.SearchCriteria();var criterion;for(var i=0;i<jsonCriteria.length;i++){if(jsonCriteria[i].terms){criterion=ct1.dealer.criteria.KeywordCriterion.fromJson(jsonCriteria[i]);}else if(jsonCriteria[i].minValue){criterion=ct1.dealer.criteria.RangeDimensionCriterion.fromJson(jsonCriteria[i]);}else if(jsonCriteria[i].parentValue){criterion=ct1.dealer.criteria.ParentChildDimensionCriterion.fromJson(jsonCriteria[i]);var j=i+1;while(j<jsonCriteria.length){if(jsonCriteria[j].parentValue!=null&&jsonCriteria[j].parentValue.name==criterion.getParentValue()){criterion.addChildValue(jsonCriteria[j].childValue.name);j++;}else{break;}}
i=j-1;}else if(jsonCriteria[i].dimension){criterion=ct1.dealer.criteria.SimpleDimensionCriterion.fromJson(jsonCriteria[i]);}else if(jsonCriteria[i].radius){criterion=ct1.dealer.criteria.GeoSearchCriterion.fromJson(jsonCriteria[i]);}else{throw new Error("Unrecognised criterion: "+jQuery.toJSON(jsonCriteria[i]));}
searchCriteria.addCriterion(criterion);}
return searchCriteria;};ct1.dealer.criteria.CriterionInterface=function(){this.toUrlPathParameter=function(){};this.clone=function(){};this.equals=function(criterion){};};ct1.dealer.criteria.DimensionCriterionInterface=function(){this.getDimensionName=function(){};};ct1.dealer.criteria.SimpleDimensionCriterion=function(dimensionName,value){var dimensionName;var value;this.getDimensionName=function(){return dimensionName;};this.getValue=function(){return value;};this.toUrlPathParameter=function(){return"/"+ct1.dealer.criteria.toSeoName(dimensionName)+"/"+ct1.dealer.criteria.toSeoName(value);};this.clone=function(){return new ct1.dealer.criteria.SimpleDimensionCriterion(dimensionName,value);};this.equals=function(criterion){return this.toUrlPathParameter()==criterion.toUrlPathParameter();};};ct1.dealer.criteria.SimpleDimensionCriterion.fromJson=function(jsonCriterion){return new ct1.dealer.criteria.SimpleDimensionCriterion(jsonCriterion.dimension.name,jsonCriterion.value.name);};ct1.dealer.criteria.ParentChildDimensionCriterion=function(dimensionName,parentDimensionName,childDimensionName,parentValue,childValues){var dimensionName;var parentDimensionName;var childDimensionName;var parentValue;var childValues;this.getDimensionName=function(){return dimensionName;};this.getParentDimensionName=function(){return parentDimensionName;};this.getChildDimensionName=function(){return childDimensionName;};this.getParentValue=function(){return parentValue;};this.getChildValues=function(){return childValues;};this.addChildValue=function(value){childValues[childValues.length]=value;};this.removeChildValue=function(value){var newChildValues=[];for(var i=0;i<childValues.length;i++){if(childValues[i]!=value){newChildValues[newChildValues.length]=childValues[i];}}
childValues=newChildValues;};this.toUrlPathParameter=function(){var urlPath="/"+ct1.dealer.criteria.toSeoName(dimensionName)+"/"+
ct1.dealer.criteria.toSeoName(parentDimensionName)+"/"+ct1.dealer.criteria.toSeoName(parentValue);for(var i=0;i<childValues.length;i++){urlPath+="/"+ct1.dealer.criteria.toSeoName(childDimensionName)+"/"+
ct1.dealer.criteria.toSeoName(childValues[i]);}
return urlPath;};this.clone=function(){var childValuesClone=[];for(var i=0;i<childValues.length;i++){childValuesClone[i]=childValues[i];}
return new ct1.dealer.criteria.ParentChildDimensionCriterion(dimensionName,parentDimensionName,childDimensionName,parentValue,childValuesClone);};this.equals=function(criterion){return this.toUrlPathParameter()==criterion.toUrlPathParameter();};};ct1.dealer.criteria.ParentChildDimensionCriterion.fromJson=function(jsonCriterion){var dimensionName=jsonCriterion.dimension.name;var parentDimensionName=jsonCriterion.dimension.parentDimension.name;var childDimensionName=jsonCriterion.dimension.childDimension.name;var parentValue=jsonCriterion.parentValue.name;var childValues=[];if(jsonCriterion.childValue!=null){childValues[0]=jsonCriterion.childValue.name;}
return new ct1.dealer.criteria.ParentChildDimensionCriterion(dimensionName,parentDimensionName,childDimensionName,parentValue,childValues);};ct1.dealer.criteria.RangeDimensionCriterion=function(dimensionName,minValue,maxValue,includeRecordsWithUnspecifiedValues){var dimensionName;var minValue;var maxValue;var includeRecordsWithUnspecifiedValues;this.getDimensionName=function(){return dimensionName;};this.getMinValue=function(){return minValue;};this.getMaxValue=function(){return maxValue;};this.isIncludeRecordsWithUnspecifiedValues=function(){return includeRecordsWithUnspecifiedValues;};this.setIncludeRecordsWithUnspecifiedValues=function(includeUnspecifiedValues){includeRecordsWithUnspecifiedValues=includeUnspecifiedValues;};this.toUrlPathParameter=function(){var url="/"+ct1.dealer.criteria.toSeoName(dimensionName)+"/"+ct1.dealer.criteria.toSeoName(minValue)+"/"+ct1.dealer.criteria.toSeoName(maxValue);if(includeRecordsWithUnspecifiedValues){url+="/unspecified";}
return url;};this.clone=function(){return new ct1.dealer.criteria.RangeDimensionCriterion(dimensionName,minValue,maxValue,includeRecordsWithUnspecifiedValues);};this.equals=function(criterion){return this.toUrlPathParameter()==criterion.toUrlPathParameter();};};ct1.dealer.criteria.RangeDimensionCriterion.fromJson=function(jsonCriterion){var dimensionName=jsonCriterion.dimension.name;var minValue=jsonCriterion.minValue.name;var maxValue=jsonCriterion.maxValue.name;var includeRecordsWithUnspecifiedValues=jsonCriterion.includeRecordsWithUnspecifiedValues;return new ct1.dealer.criteria.RangeDimensionCriterion(dimensionName,minValue,maxValue,includeRecordsWithUnspecifiedValues);};ct1.dealer.criteria.KeywordCriterion=function(terms){var terms;this.getTerms=function(){return terms;}
this.toUrlPathParameter=function(){return"/keywords/"+encodeURIComponent(terms);};this.clone=function(){return new ct1.dealer.criteria.KeywordCriterion(terms);};this.equals=function(criterion){return this.toUrlPathParameter()==criterion.toUrlPathParameter();};};ct1.dealer.criteria.KeywordCriterion.fromJson=function(jsonCriterion){return new ct1.dealer.criteria.KeywordCriterion(jsonCriterion.terms);};ct1.dealer.criteria.GeoSearchCriterion=function(radius,radiusUnit){var radius;var radiusUnit;this.getRadius=function(){return radius;};this.getRadiusUnit=function(){return radiusUnit;};this.toUrlPathParameter=function(){return"/radius/"+radius+radiusUnit.toLowerCase();};this.clone=function(){return new ct1.dealer.criteria.GeoSearchCriterion(radius,radiusUnit);};this.equals=function(criterion){return this.toUrlPathParameter()==criterion.toUrlPathParameter();};};ct1.dealer.criteria.GeoSearchCriterion.fromJson=function(jsonCriterion){return new ct1.search.criteria.GeoSearchCriterion(jsonCriterion.radius.toString(),jsonCriterion.radiusUnit);};namespace("ct1.dealer.init");ct1.dealer.init.initCommonWidgets=function(settings){var searchCriteria=ct1.dealer.criteria.SearchCriteria.fromJson(settings.jsonSearchCriteria);jQuery(".dealerSearch").dealerSearch({dealerServerUrl:settings.dealerServerUrl,searchCriteria:searchCriteria,sort:settings.sort});};ct1.dealer.init.initResults=function(settings){var searchCriteria=ct1.dealer.criteria.SearchCriteria.fromJson(settings.jsonSearchCriteria);var dealerFinder=jQuery("div.dealerFinder").dealerFinder({dealerServerUrl:settings.dealerServerUrl,staticContentServerUrl:settings.staticContentServerUrl,searchCriteria:searchCriteria});dealerFinder.updateTotalNumberOfResults(settings.totalNumberOfResults);var dealerResults=jQuery(".dealerResults").dealerResults({dealerServerUrl:settings.dealerServerUrl,dealerFinder:dealerFinder,sort:settings.sort,totalNumberOfResults:settings.totalNumberOfResults});};(function($){jQuery.fn.dealerCounter=function(settings){var $self=this;var userLocationManager=ct1.location.UserLocationManager.getInstance();var vehicleCounter;function init(){initVehicleCounter();initLocationWidget();}
function initLocationWidget(){jQuery("input[name=location]").locationWidget();}
function initVehicleCounter(){vehicleCounter=jQuery(".vehicleCounter").vehicleCounter({totalNumberOfResults:settings.totalNumberOfResults,staticContentServerUrl:settings.staticContentServerUrl});}
function parseVehicleCount($selectListOption){var text=$selectListOption.text();var number=text.substring(text.lastIndexOf("(")+1,text.lastIndexOf(")"));return ct1.utilities.parseFormattedNumber(number);}
init();return this;};})(jQuery);(function($){jQuery.fn.dealerFinder=function(settings){var dealerServerUrl=settings.searchServerUrl;var staticContentServerUrl=settings.staticContentServerUrl;var searchCriteria=settings.searchCriteria;var totalNumberOfResults;var self=this;this.getSearchCriteria=function(){return searchCriteria;};this.setSearchCriteria=function(srchCriteria){searchCriteria=srchCriteria;};this.updateTotalNumberOfResults=function(totalNumResults){if(!totalNumberOfResults||totalNumberOfResults!=totalNumResults){totalNumberOfResults=totalNumResults;}};this.getTotalNumberOfResults=function(){return totalNumberOfResults;};this.resetSearchCriteria=function(srchCriteria){searchCriteria=srchCriteria;this.closeOpenPanel();jQuery("ul.dimensions li.active").removeClass("active");};return this;};})(jQuery);(function($){jQuery.fn.dealerResults=function(settings){var dealerServerUrl=settings.dealerServerUrl;var dealerFinder=settings.dealerFinder;var userLocationManager=ct1.location.UserLocationManager.getInstance();var sort=settings.sort;init();function init(){initSortWidget();initRadiusWidget();initTextWidget();userLocationManager.afterRefreshLocation(function(){updateSearchResults(false);});}
function initTextWidget(){jQuery("input[name='location']").keydown(function(e){if(e.keyCode==13){window.location=dealerFinder.getSearchCriteria().toSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:{sort:sort}});}});}
function initSortWidget(){if(sort){jQuery(".sort select").val(sort);}
jQuery(".sort select").change(function(){var params={};var sort=jQuery(this).val();if(sort.indexOf("&")>0){var values=sort.split("&");params.sort=values[0];var keyValue;for(var i=1;i<values.length;i++){keyValue=values[i].split("=");params[keyValue[0]]=keyValue[1];}}else{params.sort=sort;}
window.location=dealerFinder.getSearchCriteria().toSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:params});return false;})}
function initRadiusWidget(){jQuery(".selectRadius select").change(function(){var userLocation=userLocationManager.getUserLocation();var sortRadius=jQuery(this).val();var radiusPath;var globalSearchCriteria=dealerFinder.getSearchCriteria();var localSearchCriteria=null;var radius=sortRadius;var radiusUnit="km";if(localSearchCriteria==null||!localSearchCriteria.equals(globalSearchCriteria)){localSearchCriteria=globalSearchCriteria.clone();}
var geoSearchCriterion=localSearchCriteria.getGeoSearchCriterion();if(geoSearchCriterion){globalSearchCriteria.removeCriterion(geoSearchCriterion);localSearchCriteria.removeCriterion(geoSearchCriterion);}
if(ct1.utilities.isNotBlank(sortRadius)){var geoSearchCriterion=new ct1.search.criteria.GeoSearchCriterion(radius,radiusUnit);globalSearchCriteria.addCriterion(geoSearchCriterion);localSearchCriteria.addCriterion(geoSearchCriterion);}
window.location=dealerFinder.getSearchCriteria().toDealerSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:{sort:sort}});return false;})}
$('.dealerSearchPartExchangeNavigation .selectWantedList').live('click',function(){var userLocation=userLocationManager.getUserLocation();var checkAdvertiserProduct=jQuery(this).attr('value');advertiserProductCriterion=null;var globalSearchCriteria=dealerFinder.getSearchCriteria();var localSearchCriteria=null;if(localSearchCriteria==null||!localSearchCriteria.equals(globalSearchCriteria)){localSearchCriteria=globalSearchCriteria.clone();}
var criteria=localSearchCriteria.getCriteria();for(var i=0;i<criteria.length;i++){if(typeof criteria[i].getDimensionName=="function"&&criteria[i].getDimensionName()=="PartExchange"){advertiserProductCriterion=criteria[i];break;}}
if(advertiserProductCriterion){globalSearchCriteria.removeCriterion(advertiserProductCriterion);localSearchCriteria.removeCriterion(advertiserProductCriterion);}
if(checkAdvertiserProduct==='PartExchangeDealers'){var geoSearchCriterion=new ct1.search.criteria.SimpleDimensionCriterion("PartExchange","Offered");globalSearchCriteria.addCriterion(geoSearchCriterion);localSearchCriteria.addCriterion(geoSearchCriterion);}
window.location=dealerFinder.getSearchCriteria().toDealerSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:{sort:sort}});return false;});function startNewSearch(){dealerFinder.getSearchCriteria().removeAllCriteria();updateSearchResults(false);}
function updateSearchResults(requiresLocation){if(requiresLocation&&userLocationManager.getUserLocation()==null){userLocationManager.chooseLocation({onSelectLocation:function(userLocation){updateSearchResults(true);}});}else{window.location=dealerFinder.getSearchCriteria().toSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:{sort:sort}});}}
return this;};})(jQuery);(function($){jQuery.fn.dealerSearch=function(settings){var dealerServerUrl=settings.dealerServerUrl;var userLocationManager=ct1.location.UserLocationManager.getInstance();var dealerFinder=jQuery("div.dealerFinder").dealerFinder({searchServerUrl:settings.searchServerUrl,staticContentServerUrl:settings.staticContentServerUrl,searchCriteria:settings.searchCriteria});var $this=this;var sort=settings.sort;var exampleKeywords;init();function init(){initSearchButton();var inputField=$this.find(".searchBox");exampleKeywords=$this.find("[name=keywordExamples]").val();inputField.focus(function(){jQuery(".newSearch").hide();inputField.val("");inputField.removeClass("example");});}
function isKeywordCriterion(criterion){return typeof criterion.getTerms=="function";}
function initSearchButton(){var $form=$this.find("form");var $searchButton=$form.find("button[type=submit]");$form.submit(function(){$searchButton.trigger("click");return false;});$searchButton.click(function(){var doSearch=function(){var userLocation=userLocationManager.getUserLocation();var url=dealerServerUrl;url+="/search?"+userLocation.toQueryStringParameters();var keywords=$this.find("input.searchBox").val();if(ct1.utilities.isNotBlank(keywords)&&keywords!=exampleKeywords){url+="&keywords="+encodeURIComponent(keywords);}
window.location=url;};if(userLocationManager.getUserLocation()==null){userLocationManager.chooseLocation({onSelectLocation:function(userLocation){doSearch();}});}else{var keywords=$this.find("input.searchBox").val();var criterion;var globalSearchCriteria=dealerFinder.getSearchCriteria();var localSearchCriteria=null;var keywordCriterion=null;if(localSearchCriteria==null||!localSearchCriteria.equals(globalSearchCriteria)){localSearchCriteria=globalSearchCriteria.clone();}
var criteria=localSearchCriteria.getCriteria();for(var i=0;i<criteria.length;i++){if(isKeywordCriterion(criteria[i])){keywordCriterion=criteria[i];break;}}
if(keywordCriterion){globalSearchCriteria.removeCriterion(keywordCriterion);localSearchCriteria.removeCriterion(keywordCriterion);}
if(ct1.utilities.isNotBlank(keywords)&&keywords!=exampleKeywords){var keywordsCriterion=new ct1.search.criteria.KeywordCriterion(keywords);globalSearchCriteria.addCriterion(keywordsCriterion);localSearchCriteria.addCriterion(keywordsCriterion);}
window.location=dealerFinder.getSearchCriteria().toDealerSearchUrl({dealerServerUrl:dealerServerUrl,searchPath:"/search",params:{sort:sort}});}
return false;});}
return this;};})(jQuery);namespace("ct1.home");ct1.home.init=function(settings){jQuery("form[name=quickSearch]").quickSearch(settings);ct1.initializeFinanceTabs();jQuery(".keySrch .textSearch").keywordSearch(settings);jQuery(".quickCont").magShortCodeSearch(settings);if(ct1.signIn.isUserSignedIn()){ct1.home.loadHomePageWatchlist(settings.searchServerUrl);}else{ct1.signIn.executeAfterSignIn("ct1.home.loadHomePageWatchlist('"+settings.searchServerUrl+"');");}
ct1.home.tabulateSeoLinksModule();ct1.home.upgradeBrowser();ct1.home.locationSelector();};ct1.home.hideHomePageWatchlist=function(searchServerUrl){var $watchlistContainer=jQuery(".homepageWatchlist");ct1.signIn.executeAfterSignIn("ct1.home.loadHomePageWatchlist('"+searchServerUrl+"');");$watchlistContainer.animate({height:0},500,function(){ct1.fireDomChanged();});$watchlistContainer.addClass("hidden").attr("css","");};ct1.home.loadHomePageWatchlist=function(searchServerUrl){var $watchlistContainer=jQuery(".homepageWatchlist");if($watchlistContainer.length>0){jQuery.ajax({url:searchServerUrl+"/home/watchlist",dataType:"html",type:"GET",cache:false,success:function(responseHtml){if(responseHtml.trim().length>0){$watchlistContainer.html(responseHtml);$watchlistContainer.removeClass("hidden");$watchlistContainer.slideDown(500,function(){ct1.fireDomChanged();$('.watchListTab').removeClass('hidden');if($.cookie('storedTabs')==null){$('.browseByTitle',$('.watchListTab').closest('div')).removeClass("selected");$('.browseByTitle.watchListTab').addClass("selected");$('.latestAndWatchlisedAdverts .browseBy').addClass("hidden");$watchlistContainer.closest('div.browseBy').removeClass("hidden");}
ct1.home.updateSelectedTab();});}}});}
ct1.signIn.executeAfterSignOut("ct1.home.hideHomePageWatchlist('"+searchServerUrl+"')");};ct1.home.tabulateSeoLinksModule=function(){$(".browseByTabs").each(function(){var $moduleContainer=$(this).closest("div");jQuery(".browseByTitle:eq(0)",$moduleContainer).addClass("selected");jQuery(".browseBy:gt(0)",$moduleContainer).addClass("hidden");});jQuery(".browseByTitle").click(function(){var $heading=jQuery(this);var $moduleContainer=$($(this).parents("div")[0]);var $linksContainers=$moduleContainer.children(".browseBy");var $headings=jQuery(".browseByTitle",$moduleContainer);var $linksContainer=jQuery($linksContainers[$headings.index($heading)]);var $selectedHeading=jQuery(".browseByTitle.selected",$moduleContainer);var $selectedLinksContainer=jQuery(".browseBy:not(.hidden)",$moduleContainer);$selectedHeading.removeClass("selected");$heading.addClass("selected");$selectedLinksContainer.addClass("hidden");$linksContainer.removeClass("hidden");if($('ul',$moduleContainer).hasClass('storedTabs')){var s=$('ul',$moduleContainer).attr('id');$.cookie('storedTabs',$.cookie('storedTabs').replace(RegExp("("+s+")=\\d+"),"$1="+$(this).index()));}
return false;});};ct1.home.updateSelectedTab=function(){$(".browseByTabs").each(function(){var $moduleContainer=$(this).closest("div");var storedTabs=$.cookie('storedTabs');var tabInfo;var tabSelected;var indexSelected;if($(this).hasClass('storedTabs')){var tabId=$(this).attr('id');var $this=$(this);if(storedTabs==null){$.cookie('storedTabs',tabId+'='+$(".browseByTitle.selected",$moduleContainer).index());}else if(!(storedTabs.indexOf(tabId)>=0)){$.cookie('storedTabs',storedTabs+'|'+tabId+'='+$(".browseByTitle.selected",$moduleContainer).index());}else{tabInfo=storedTabs.split('|');$.each(tabInfo,function(index,value){if(value.indexOf(tabId)>=0){tabSelected=value.split('=');indexSelected=1*tabSelected[1];}});if($('li',$this).length>=indexSelected){$('li',$this).each(function(index){if(index==indexSelected){$(".browseByTitle:eq("+index+")",$moduleContainer).addClass("selected");$(".browseBy:eq("+index+")",$moduleContainer).removeClass("hidden");}else{$(".browseByTitle:eq("+index+")",$moduleContainer).removeClass("selected");$(".browseBy:eq("+index+")",$moduleContainer).addClass("hidden");}});}}}});}
ct1.home.upgradeBrowser=function(){browserObj={upgrade1:"Firefox/3",upgrade2:"Firefox/4",upgrade3:"Firefox/5",upgrade4:"MSIE 6",upgrade5:"MSIE 7"};var str;for(prop in browserObj){var browser=browserObj[prop];var userBrowser=navigator.userAgent;var p=jQuery(".upgradeBrows");if(jQuery(".upgradeBrows").length){if(userBrowser.contains(browser)){jQuery(".upgradeBrows").removeClass("hidden");var position=p.position();var updatecont=jQuery(".browsUpdate");jQuery(".browsUpdate").css({"position":"absolute","left":position.left,"top":position.top}).insertAfter(".frame1");jQuery(".browsUpdate").addClass("upgrade").removeClass("hidden");}}};ct1.fireDomChanged();};ct1.home.locationSelector=function(){showTownBox=function(){$(".locationChangeContainer .simple_popdiv").hide();};$('.locationChangeContainer').find(".townBox").distanceWidget(null);$(".locationChangeContainer #chooseLocation").click(function(){showTownBox();});if(ct1.location.UserLocationManager.getInstance().getUserLocation()!=null&&ct1.location.UserLocationManager.getInstance().getUserLocation().getName().length>0){showTownBox();};};(function($){jQuery.fn.keywordSearch=function(settings){var $this=this;function init(){initSubmitForm();initTextField();}
function initSubmitForm(){$this.find("form").submit(function(){submitForm();return false;});$this.find(".searchButton").click(function(){submitForm();return false;});}
function initTextField(){var $input=$this.find(".searchBox");$input.focus(function(){if($input.val().startsWith("e.g.")){$input.val("");$input.removeClass("example");}else{$input.select();}});}
function submitForm(){var keywords=$this.find("input.searchBox").val();var searchCriteria=new ct1.search.criteria.SearchCriteria();if(!keywords.startsWith("e.g.")&&ct1.utilities.isNotBlank(keywords)){searchCriteria.addCriterion(new ct1.search.criteria.KeywordCriterion(keywords));}
window.location=searchCriteria.toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/search"});}
init();return this;};})(jQuery);(function($){jQuery.fn.magShortCodeSearch=function(settings){var $this=this;function init(){initSubmitForm();}
function initSubmitForm(){$this.find("form").submit(function(){submitForm();return false;});$this.find("form button").click(function(){submitForm();return false;});}
function showErrorMessage(){$this.find(".errorMessage").removeClass("hidden");}
function submitForm(){var magShortCode=$this.find("input[name=quickCode]").val();if(ct1.utilities.isNotBlank(magShortCode)){jQuery.ajax({url:settings.searchServerUrl+"/magazine-short-code/"+magShortCode.toLowerCase()+"/advert-url",dataType:"json",type:"GET",cache:true,success:function(data,textStatus,jqXHR){if(data&&data.advertUrl){window.location=data.advertUrl;}else{showErrorMessage();}},error:function(jqXHR,textStatus,errorThrown){showErrorMessage();}});}}
init();return this;};})(jQuery);(function($){jQuery.fn.whatWorth=function(settings){var selectLists;var $this=this;var serverUrl=settings.searchServerUrl;function init(){initSelectLists();}
function initSelectLists(){selectLists={};var $selectLists=$this.find("select");var $selectList=null;var name=null;for(var i=0;i<$selectLists.length;i++){$selectList=jQuery($selectLists[i]);name=$selectList.attr("name");selectLists[name]=$selectList;$selectList.change(function(){var $selectList=selectLists[this.name];var $selectedOption=$selectList.find("option:selected");selectOption($selectList,$selectedOption);});}}
function selectOption($selectList,$selectedOption){if($selectList.attr("name")=="make"){getModelRefinements($selectedOption);}else if($selectList.attr("name")=="model"){getYearRefinements($selectedOption);}}
function getYearRefinements($selectedOption){var $yearSelectList=jQuery("select[name=year]");var $selectedMakeOption=jQuery("select[name=make]").find("option:selected");if($selectedOption.val()==""){jQuery("select[name=year] option[value!='']").remove();$yearSelectList.attr("disabled","disabled");return;}
jQuery.ajax({url:serverUrl+"/what-worth?searchYearRefinements&model="+$selectedOption.val()+"&make="+$selectedMakeOption.val(),dataType:"json",type:"GET",cache:false,success:function(yearRefinements){jQuery("select[name=year] option[value!='']").remove();var year;var optionsFragment=document.createDocumentFragment();for(var i=0;i<yearRefinements.length;i++){year=yearRefinements[i];if(year!=null){var $option=document.createElement("option");$option.textContent=year.name;$option.id=year.name;$option.setAttribute("name",year.name);optionsFragment.appendChild($option);}}
$yearSelectList.append(optionsFragment.cloneNode(true));$yearSelectList.removeAttr("disabled");}});}
function getModelRefinements($selectedOption){var $modelSelectList=jQuery("select[name=model]");var $yearSelectList=jQuery("select[name=year]");if($selectedOption.val()==""){jQuery("select[name=model] option[value!='']").remove();$modelSelectList.attr("disabled","disabled");getYearRefinements($modelSelectList.find("option:selected"));return;}
jQuery.ajax({url:serverUrl+"/what-worth?searchModelRefinements&make="+$selectedOption.val(),dataType:"json",type:"GET",cache:false,success:function(modelRefinements){jQuery("select[name=model] option[value!='']").remove();var model;var optionsFragment=document.createDocumentFragment();for(var i=0;i<modelRefinements.length;i++){model=modelRefinements[i];if(model!=null){var $option=document.createElement("option");$option.textContent=model.name;$option.id=model.name;$option.setAttribute("name",model.name);optionsFragment.appendChild($option);}}
$modelSelectList.append(optionsFragment.cloneNode(true));jQuery("select[name=year] option:first").attr("selected","selected");$yearSelectList.attr("disabled","disabled");$modelSelectList.removeAttr("disabled");}});}
init();return this;};})(jQuery);namespace("ct1.location");ct1.location.UserLocation=function(){var _countryCode;var _county;var _latitude;var _longitude;var _name;this.getCountryCode=function(){return _countryCode;};this.getCounty=function(){return _county;};this.getLatitude=function(){return _latitude;};this.getLongitude=function(){return _longitude;};this.getName=function(){return _name;};this.setCountryCode=function(countryCode){_countryCode=countryCode;};this.setCounty=function(county){_county=county;};this.setLatitude=function(latitude){_latitude=latitude;};this.setLongitude=function(longitude){_longitude=longitude;};this.setName=function(name){_name=name;};};ct1.location.UserLocation.prototype.toQueryStringParameters=function(){var queryString="locationName="+encodeURIComponent(this.getName())+"&latitude="+this.getLatitude()+"&longitude="+this.getLongitude();if(this.getCounty()!=null){queryString+="&county="+encodeURIComponent(this.getCounty());}
return queryString;};ct1.location.UserLocation.fromJson=function(jsonLocation){var userLocation=new ct1.location.UserLocation();userLocation.setName(jsonLocation.name);userLocation.setLatitude(jsonLocation.latitude);userLocation.setLongitude(jsonLocation.longitude);userLocation.setCountryCode(jsonLocation.countryCode);userLocation.setCounty(jsonLocation.county);return userLocation;};ct1.location.UserLocation.fromCookie=function(){var userLocation=null;var cookieValue=jQuery.cookie("UserLocation");if(cookieValue!=null){userLocation=new ct1.location.UserLocation();var userLocationData=ct1.cookieValueParser.parse(cookieValue);userLocation.setName(userLocationData.name);userLocation.setLatitude(userLocationData.latitude);userLocation.setLongitude(userLocationData.longitude);userLocation.setCounty(userLocationData.county);}
return userLocation;};ct1.location.writeLocationWidgetHtml=function(locationWidgetHtml){var userLocationManager=ct1.location.UserLocationManager.getInstance();var userLocation=userLocationManager.getUserLocation();if(userLocation==null){locationWidgetHtml=locationWidgetHtml.replace("userLocation.name","").replace("hiddenIfUserLocationEmpty","hidden").replace("hiddenIfUserLocationNotEmpty","");}else{locationWidgetHtml=locationWidgetHtml.replace("userLocation.name",userLocation.getName()).replace("hiddenIfUserLocationEmpty","").replace("hiddenIfUserLocationNotEmpty","hidden");}
document.write(locationWidgetHtml);};ct1.location.UserLocationManager=(function(){var _instance=null;var _cookieDomain;function createInstance(){return{getUserLocation:function(){return ct1.location.UserLocation.fromCookie();},setUserLocation:function(location){var cookieValue="name="+location.getName()+"&latitude="+location.getLatitude()+"&longitude="+
location.getLongitude();if(location.getCounty()!=null){cookieValue+="&county="+location.getCounty();}
jQuery.cookie("UserLocation",cookieValue,{path:"/",expires:365,domain:_cookieDomain});},afterRefreshLocation:function(afterRefreshLocation){_afterRefreshLocation=afterRefreshLocation;}};}
return{getInstance:function(){if(_instance==null){throw new Error("UserLocationManager has not been initialised!");}
return _instance;},initialize:function(cookieDomain){_cookieDomain=cookieDomain;_instance=createInstance();}};})();(function($){jQuery.fn.locationWidget=function(settings){var locations=[];var userLocationManager;var syncWithCookie;var userSelectedFromList=false;var $errorMessageContainer;var $this=this;function clearErrorMessage(){if($errorMessageContainer.length>0){$errorMessageContainer.empty();}}
function displayErrorMessage(message){if($errorMessageContainer.length>0){$errorMessageContainer.text(message);}}
function enableCrossDomainRequestFromLocalhost(geoLocateServiceUrl){if(location.hostname=="localhost"){geoLocateServiceUrl="http://dev.autotrader.co.za"+geoLocateServiceUrl;}
return geoLocateServiceUrl;}
function getGeoLocateServiceUrl(){return enableCrossDomainRequestFromLocalhost("/geolocate-service");}
function getLocation(description){for(var i=0;i<locations.length;i++){if(locations[i].description==description){return locations[i];}}}
function init(){userLocationManager=ct1.location.UserLocationManager.getInstance();$errorMessageContainer=$this.next(".errorMessage");initSyncWithCookie();initTextField();initAutoComplete();initBlur();}
function initAutoComplete(){$this.autocomplete({focus:function(){return false;},minLength:2,select:function(event,ui){var location=getLocation(ui.item.value);selectLocation(location);return false;},source:function(request,response){jQuery.ajax({url:getGeoLocateServiceUrl()+"/complete/"+request.term+"/title/SCAT/country/ZA",dataType:"json",success:function(jsonLocations,status,xmlHttpRequest){clearErrorMessage();if(jsonLocations.length==0){displayErrorMessage("Location not found");}
setLocations(jsonLocations);var descriptions=[];for(var i=0;i<jsonLocations.length;i++){descriptions[i]=jsonLocations[i].description;}
response(descriptions);},error:function(xmlHttpRequest,status,error){displayErrorMessage("Unexpected error, please try again");}});}});}
function initBlur(){$this.blur(function(){if(!userSelectedFromList){var value=$this.val();var location=null;for(var i=0;i<locations.length&&location==null;i++){if(locations[i].name.equalsIgnoreCase(value)){location=locations[i];}}
if(location!=null){selectLocation(location);}else{displayErrorMessage("Location not found");}}});}
function initSyncWithCookie(){if(settings!=undefined&&settings.syncWithCookie!=undefined){syncWithCookie=settings.syncWithCookie;}else{syncWithCookie=true;}}
function initTextField(){if(syncWithCookie){var userLocation=userLocationManager.getUserLocation();if(userLocation!=null){$this.val(userLocation.getName());}}
$this.focus(function(){if($this.val().startsWith("e.g.")||$this.val().equalsIgnoreCase("Your Location")){$this.val("");}else{$this.select();}});}
function selectLocation(location){clearErrorMessage();var userLocation=ct1.location.UserLocation.fromJson(location);$this.val(userLocation.getName());if(syncWithCookie){userLocationManager.setUserLocation(userLocation);}
if(settings&&settings.onSelectLocation){settings.onSelectLocation(userLocation);}
$this.autocomplete("close");userSelectedFromList=true;}
function setLocations(jsonLocations){locations=[];for(var i=0;i<jsonLocations.length;i++){locations[i]={description:jsonLocations[i].description,name:jsonLocations[i].name,latitude:jsonLocations[i].latitude,longitude:jsonLocations[i].longitude,postcode:jsonLocations[i].outwardPostcode,countryCode:jsonLocations[i].countryCode,county:jsonLocations[i].county};}
userSelectedFromList=false;}
init();return this;};})(jQuery);namespace("ct1.ola");ct1.ola.advertPreview=function(){function setClearAdditionalTitle(olaForm,isToClear){var clearAdditionalTitle=olaForm.find("input[name=ola.clearAdditionalTitle]");jQuery(clearAdditionalTitle).attr("value",isToClear);}
function initCheckRegions(){var olaForm=jQuery("#olaAdvertPreview");if(olaForm===null||olaForm.length<1){return;}
setCheckRegions(olaForm);}
function setCheckRegions(olaForm){var chosenRegion=getChosenRegion(olaForm);var additionalRegions=olaForm.find("input[name=ola.additionalTitleIds]");var additionalRegional=olaForm.find(".additionalRegional");if(additionalRegional.length===1){var additionalRegionalChecked=olaForm.find("input[name=additionalRegionalChoice]:checked");if(jQuery(additionalRegionalChecked).val()!==""){var chosenCommerceItemId=olaForm.find("span."+chosenRegion).html();jQuery(additionalRegional).attr("value",chosenCommerceItemId);}}else{for(var i=0;i<additionalRegions.length;i++){if(jQuery(additionalRegions[i]).hasClass(chosenRegion)){jQuery(additionalRegions[i]).closest("li").hide();jQuery(additionalRegions[i]).attr("checked",false);}else{jQuery(additionalRegions[i]).closest("li").show();}}}
setRegionImage(olaForm,chosenRegion);setRegionClass(olaForm);setDeadlineMessage(olaForm,chosenRegion);checkClearAdditionalTitle(olaForm);}
function getChosenRegion(olaForm){var chosenRegion='';var regionSelector=olaForm.find(".regionSelector");if(regionSelector.length>0){chosenRegion=regionSelector.val();}else{chosenRegion=olaForm.find(".chosenRegion").html();}
return chosenRegion;}
function setCommerceTitleCode(olaForm,chosenRegion){var channel=olaForm.find("input[name='ola.channel']").val();var packageIdValue=olaForm.find("input[name='packageIdValue']").val();if(channel==='van'&&packageIdValue.indexOf("7")==-1){olaForm.find("input[name=ola.commerceTitleCode]").val(chosenRegion);}}
function checkClearAdditionalTitle(olaForm){var checkedRegions=olaForm.find("input[name=ola.additionalTitleIds]:checked");if(checkedRegions.length>0||isAdditionalNationalSelected(olaForm)){setClearAdditionalTitle(olaForm,false);}else{setClearAdditionalTitle(olaForm,true);}}
function isAdditionalNationalSelected(olaForm){var hiddenNationals=olaForm.find("input[name=ola.additionalTitleIds][type=hidden]");if(hiddenNationals.length>0){for(var i=0;i<hiddenNationals.length;i++){if(jQuery(hiddenNationals[i]).attr('value')!==''){return true;}}}
return false;}
function setRegionImage(olaForm,chosenRegion){var additionalRegions=olaForm.find("input[name=ola.additionalTitleIds]:checked");var regionImages=olaForm.find(".regionImage");var pixelPath=olaForm.find(".pixel").html();regionImages.supersleight({shim:pixelPath});regionImages.hide();for(var i=0;i<regionImages.length;i++){if(isAdditionalRegion(regionImages[i],additionalRegions)||jQuery(regionImages[i]).hasClass(chosenRegion.toLowerCase())){jQuery(regionImages[i]).show();}}}
function isAdditionalRegion(regionImage,additionalRegions){for(var i=0;i<additionalRegions.length;i++){var additionalRegionCode=jQuery(additionalRegions[i]).attr('class');if(jQuery(regionImage).hasClass(additionalRegionCode.toLowerCase())){return true;}}
return false;}
function setRegionClass(olaForm){var regionClass=olaForm.find('.regionClass');if(regionClass===null||regionClass.length!==1){return;}
var additionalRegional=olaForm.find('.additionalRegional');if(additionalRegional.length===0){setAddtionalRegionsClass(olaForm);}else{if(additionalRegional.val()!==""){var regionClassValue=olaForm.find('.additionalRegionClassCode').text();regionClass.attr('value',additionalRegional.val()+"_"+regionClassValue);}else{regionClass.attr('value',"");}}}
function setDeadlineMessage(olaForm,chosenRegion){var deadlinesText=olaForm.find('.deadlines').html();if(deadlinesText===null){return;}
var deadlines=deadlinesText.split("|");for(var i=0;i<deadlines.length;i++){var titleDeadline=deadlines[i].split(":");var regionCode=titleDeadline[0].replace(/\n/g,"");if(chosenRegion===$.trim(regionCode)){olaForm.find('.deadline').html(titleDeadline[1]);break;}}}
function toggleAdditionalNationalClass(olaForm,additionalNationalIdLabel,additionalNationalIdValue){var additionalNationalClassCodeLabel=olaForm.find('.additionalNationalClassCode');if(additionalNationalClassCodeLabel.length<=1){return;}
var defaultAdditionalNationalClass=olaForm.find('.defaultAdditionalNationalClass').html();var checked=additionalNationalIdValue===""?"":"checked";var disabled=additionalNationalIdValue===""?"disabled":"";for(var i=0;i<additionalNationalClassCodeLabel.length;i++){var additionalNationalClassCodeValue=jQuery(additionalNationalClassCodeLabel[i]).val();if(checked!=="checked"||additionalNationalClassCodeValue===defaultAdditionalNationalClass){jQuery(additionalNationalClassCodeLabel[i]).attr('checked',checked);var additionalNationalClass=olaForm.find('.classCode_'+additionalNationalIdLabel);var classCode=additionalNationalIdValue===""?"":additionalNationalClassCodeValue;additionalNationalClass.attr("value",classCode);}
jQuery(additionalNationalClassCodeLabel[i]).attr('disabled',disabled);}}
function toggleAdditionalRegionalClass(olaForm,additionalRegionalIdLabel,additionalRegionalIdValue){var additionalRegionalClassCodeLabel=olaForm.find('.additionalRegionalClassCode');var defaultAdditionalRegionalClass=olaForm.find('.defaultAdditionalRegionalClass').html();var checked=additionalRegionalIdValue===""?"":"checked";var disabled=additionalRegionalIdValue===""?"disabled":"";for(var i=0;i<additionalRegionalClassCodeLabel.length;i++){var additionalRegionalClassCodeValue=jQuery(additionalRegionalClassCodeLabel[i]).val();if(checked!=="checked"||additionalRegionalClassCodeValue===defaultAdditionalRegionalClass){jQuery(additionalRegionalClassCodeLabel[i]).attr('checked',checked);var additionalRegionalClass=olaForm.find('.classCode_'+additionalRegionalIdLabel);var classCode=additionalRegionalIdValue===""?"":additionalRegionalClassCodeValue;additionalRegionalClass.attr("value",classCode);}
jQuery(additionalRegionalClassCodeLabel[i]).attr('disabled',disabled);}}
function toggleAdditionalNINationalClass(olaForm,additionalNationalIdLabel,additionalNationalIdValue){var additionalNationalClassCodeLabel=olaForm.find('.additionalNationalNIClassCode');if(additionalNationalClassCodeLabel.length<=1){return;}
var defaultAdditionalNationalClass=olaForm.find('.defaultAdditionalNationalNIClass').html();var checked=additionalNationalIdValue===""?"":"checked";var disabled=additionalNationalIdValue===""?"disabled":"";for(var i=0;i<additionalNationalClassCodeLabel.length;i++){var additionalNationalClassCodeValue=jQuery(additionalNationalClassCodeLabel[i]).val();if(checked!=="checked"||additionalNationalClassCodeValue===defaultAdditionalNationalClass){jQuery(additionalNationalClassCodeLabel[i]).attr('checked',checked);var additionalNationalClass=olaForm.find('.classCode_'+additionalNationalIdLabel);var classCode=additionalNationalIdValue===""?"":additionalNationalClassCodeValue;additionalNationalClass.attr("value",classCode);}
jQuery(additionalNationalClassCodeLabel[i]).attr('disabled',disabled);}}
function setAddtionalRegionsClass(olaForm){var checkedRegions=olaForm.find("input[name=ola.additionalTitleIds]:checked");if(checkedRegions.length>0){for(var i=0;i<checkedRegions.length;i++){var additionalTitleId=jQuery(checkedRegions[i]).attr("value")
setAdditionalRegionClass(olaForm,additionalTitleId);}}}
function setAdditionalRegionClass(olaForm,additionalTitleId){var titleClass=olaForm.find('.regionClass');var additionalTitleClass=olaForm.find('.additionalRegionClass_'+additionalTitleId.replace(".",""));var classCode=titleClass.val();classCode=additionalTitleId+"_"+classCode;additionalTitleClass.attr('value',classCode);}
$('#olaAdvertPreview .additionalNational').live('click',function(){var olaForm=jQuery(this).closest('form');var additionalNationalIdLabel=jQuery(this).attr('name');var additionalNationalIdValue=jQuery(this).attr('value');var additionalNationalIdParam=olaForm.find('.'+additionalNationalIdLabel);additionalNationalIdParam.attr('value',additionalNationalIdValue);toggleAdditionalNationalClass(olaForm,additionalNationalIdLabel,additionalNationalIdValue)
checkClearAdditionalTitle(olaForm);});$('#olaAdvertPreview .additionalNationalNI').live('click',function(){var olaForm=jQuery(this).closest('form');var additionalNationalIdLabel=jQuery(this).attr('name');var additionalNationalIdValue=jQuery(this).attr('value');var additionalNationalIdParam=olaForm.find('.'+additionalNationalIdLabel);additionalNationalIdParam.attr('value',additionalNationalIdValue);toggleAdditionalNINationalClass(olaForm,additionalNationalIdLabel,additionalNationalIdValue)
checkClearAdditionalTitle(olaForm);});$('#olaAdvertPreview .additionalRegionalChoice').live('click',function(){var olaForm=jQuery(this).closest('form');var additionalRegionalIdLabel=jQuery(this).attr('name');var additionalRegionalIdValue=jQuery(this).attr('value');var additionalRegionalIdParam=olaForm.find('.'+additionalRegionalIdLabel);additionalRegionalIdParam.attr('value',additionalRegionalIdValue);toggleAdditionalRegionalClass(olaForm,additionalRegionalIdLabel,additionalRegionalIdValue);var chosenRegion=olaForm.find('.chosenRegion').text();setDeadlineMessage(olaForm,chosenRegion);checkClearAdditionalTitle(olaForm);});$('#olaAdvertPreview .additionalNationalClassCode').live('click',function(){var olaForm=jQuery(this).closest('form');if(olaForm.find('.additionalNationalClassCode').length===1){return;}
var additionalNationalIdLabel=jQuery(this).attr('name');var additionalNationalIdValue=jQuery(this).attr('value');var additionalNationalIdParam=olaForm.find('.'+additionalNationalIdLabel);additionalNationalIdParam.attr('value',additionalNationalIdValue);});$('#olaAdvertPreview .additionalNationalNIClassCode').live('click',function(){var olaForm=jQuery(this).closest('form');if(olaForm.find('.additionalNationalNIClassCode').length===1){return;}
var additionalNationalIdLabel=jQuery(this).attr('name');var additionalNationalIdValue=jQuery(this).attr('value');var additionalNationalIdParam=olaForm.find('.'+additionalNationalIdLabel);additionalNationalIdParam.attr('value',additionalNationalIdValue);});$('#olaAdvertPreview .additionalRegionalClassCode').live('click',function(){var olaForm=jQuery(this).closest('form');if(olaForm.find('.additionalRegionalClassCode').length===1){return;}
var additionalRegionalIdLabel=jQuery(this).attr('name');var additionalRegionalIdValue=jQuery(this).attr('value');var additionalRegionalIdParam=olaForm.find('.'+additionalRegionalIdLabel);additionalRegionalIdParam.attr('value',additionalRegionalIdValue);});$('#olaAdvertPreview .commerceClassCode').live('click',function(){var olaForm=jQuery(this).closest('form');if(olaForm.find('.commerceClassCode').length===1){return;}
var additionalNationalIdLabel=jQuery(this).attr('name');var additionalNationalIdValue=jQuery(this).attr('value');var additionalNationalIdParam=olaForm.find('.'+additionalNationalIdLabel);additionalNationalIdParam.attr('value',additionalNationalIdValue);});$('#olaAdvertPreview input[name=ola.additionalTitleIds]').live('click',function(){var olaForm=jQuery(this).closest("form");checkClearAdditionalTitle(olaForm);setAdditionalRegionClass(olaForm,jQuery(this).attr("value"));setRegionImage(olaForm,olaForm.find('.regionSelector').val());});$('#olaAdvertPreview .regionSelector').change(function(){var olaForm=jQuery(this).closest("form");setCheckRegions(olaForm);});$('#o_wp_fullPageFadeArea').live('mouseover mouseout',function(event){if(event.type=='mouseover')
$('#o_wp_fullPageFade').show();else if(event.type=='mouseout')
$('#o_wp_fullPageFade').hide();});$('#o_wp_listingFadeArea').live('mouseover mouseout',function(event){if(event.type=='mouseover')
$('#o_wp_listingFade').show();else if(event.type=='mouseout')
$('#o_wp_listingFade').hide();});initCheckRegions();}
namespace("ct1.ola");ct1.ola.category=function(){var aboutYour=new Array();var tellMore=new Array();var storedSubcategories=new Array();function initFormForCategory(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var channel=olaForm.find("input[name='ola.channel']").attr("value");if(channel==='boat'){toggleYear(olaForm,channel,category);}
var categorySelect=olaForm.find(".categorySelect");if(categorySelect===null||categorySelect.length<1){return;}
var category=categorySelect.attr("value");if(category!==''){setSubmitName(olaForm,channel,category);var subCategory=olaForm.find(".subcategorySelect").attr("value");showSubcategory(olaForm,channel,category)
olaForm.find(".subcategorySelect").attr("value",subCategory);showVrm(olaForm,channel,category);displayCorrectForm(olaForm,channel,category);}
toggleYear(olaForm,channel,category);toggleBodyType(olaForm,channel,category);toggleTrailerTypes(olaForm,channel,category);}
function displayCorrectForm(olaForm,channel,category){if(channel!=='truck'&&channel!=='caravan'){return;}
if(aboutYour.length===0){aboutYour=olaForm.find(".aboutYour");}
if(tellMore.length===0){tellMore=olaForm.find(".tellMore");}
var formattedCategory=formatCategory(category);for(var i=0;i<aboutYour.length;i++){if(jQuery(aboutYour[i]).hasClass(formattedCategory)){olaForm.find(".aboutYour").replaceWith(jQuery(aboutYour[i]));break;}}
for(var i=0;i<tellMore.length;i++){if(jQuery(tellMore[i]).hasClass(formattedCategory)){olaForm.find(".tellMore").replaceWith(jQuery(tellMore[i]));break;}}
olaForm.find(".aboutYour").hide();olaForm.find(".tellMore").hide();olaForm.find("."+formattedCategory).show();checkRadioChoice(olaForm);}
function checkRadioChoice(olaForm){var driverLeftOrRight=olaForm.find(".driverLeftOrRight");var radios=olaForm.find(".radio");for(var i=0;i<radios.length;i++){if(driverLeftOrRight.html()===jQuery(radios[i]).attr('value')){jQuery(radios[i]).click();}}}
function formatCategory(category){return category.replace(/\s/g,'').toLowerCase();}
function setSubmitName(olaForm,channel,category){if(channel==='truck'||channel==='caravan'){var validateButton=olaForm.find("input[name='_eventName']");jQuery(validateButton).attr("name","validate-"+formatCategory(category));}}
function showSubcategory(olaForm,channel,selectedCategory){if(storedSubcategories.length===0){storedSubcategories=olaForm.find(".subcategoryOption");}
if(isSubcategoryViewable(channel,selectedCategory)){olaForm.find(".subcategorySelect").attr("value","");olaForm.find(".noSubcategory").removeClass("noSubcategory").addClass("subcategory");var biggerBox=jQuery(".mmvFindYour").height();jQuery(".fakedpositioning").css("height",biggerBox+"px");showSubcategoryOptions(olaForm,selectedCategory);}else{olaForm.find(".subcategory").removeClass("subcategory").addClass("noSubcategory");olaForm.find(".subcategorySelect").attr("value","");olaForm.find(".subcategorySelect").empty();}}
function showSubcategoryOptions(olaForm,selectedCategory){var formattedSelectedCategory=formatCategory(selectedCategory);var chosenSubcategories=storedSubcategories.filter("."+formattedSelectedCategory);var subcategorySelect=olaForm.find(".subcategorySelect");subcategorySelect.empty();subcategorySelect.append(storedSubcategories[0]);subcategorySelect.append(chosenSubcategories);subcategorySelect.attr("selectedIndex",0);}
function isSubcategoryViewable(channel,selectedCategory){if(channel==='truck'&&selectedCategory!=='Trailers'){return false;}
if(channel==='plant'&&selectedCategory===''){return false;}
if(channel==='farm'&&selectedCategory===''){return false;}
return true;}
function showVrm(olaForm,channel,selectedCategory){if(isVrmViewable(channel,selectedCategory)){olaForm.find(".noOlaVrm").removeClass("noOlaVrm").addClass("olaVrm");}else{olaForm.find(".olaVrm").removeClass("vrmError");olaForm.find(".olaVrm").removeClass("olaVrm").addClass("noOlaVrm");olaForm.find(".vrmInput").attr("value","");if(jQuery.browser.version.startsWith("6")){olaForm.find(".mmvItems").css('left','1px');}}}
function isVrmViewable(channel,selectedCategory){if(channel==='truck'&&selectedCategory==='Trailers'){return false;}
if(channel==='plant'||channel==='farm'||channel==='caravan'||channel==='boat'){return false;}
return true;}
function toggleYear(olaForm,channel,category){if(isVrmViewable(channel,category)){olaForm.find(".yearItems").attr('name','ola.stockItem.regYear');olaForm.find(".yearOfManLabel").hide();olaForm.find(".yearOfRegLabel").show();}else{olaForm.find(".yearItems").attr('name','ola.stockItem.manufactureYear');olaForm.find(".yearOfRegLabel").hide();olaForm.find(".yearOfManLabel").show();}}
function toggleBodyType(olaForm,channel,selectedCategory){if(channel!=='plant'){return;}
var plantBodyType=olaForm.find('.plantBodyType');if(selectedCategory=='Trailers'){plantBodyType.show();}else{olaForm.find('.plantBodyTypeSelect').attr('value','');plantBodyType.hide();}}
function toggleTrailerTypes(olaForm,channel,selectedCategory){if(channel!=='plant'){return;}
var plantTrailerAxles=olaForm.find('.plantTrailerAxles');var plantAxleConfig=olaForm.find('.plantAxleConfig');if(selectedCategory=='Trailers'){olaForm.find('.plantAxleConfigSelect').attr('value','');plantTrailerAxles.show();plantAxleConfig.hide();}else{olaForm.find('.plantTrailerAxlesSelect').attr('value','');plantTrailerAxles.hide();plantAxleConfig.show();}}
function clearErrors(olaForm){olaForm.find('.olaerror').hide();olaForm.find('.olaErrorBase').hide();olaForm.find('.error').removeClass('error');}
$('.categorySelect').change(function(e){e.preventDefault();var olaForm=jQuery(jQuery(this).closest("form"));var channel=olaForm.find("input[name='ola.channel']").attr("value");var selectedCategory=jQuery(this).attr("value");setSubmitName(olaForm,channel,selectedCategory);showSubcategory(olaForm,channel,selectedCategory);showVrm(olaForm,channel,selectedCategory);toggleYear(olaForm,channel,selectedCategory);toggleBodyType(olaForm,channel,selectedCategory);toggleTrailerTypes(olaForm,channel,selectedCategory);if(selectedCategory!==''){displayCorrectForm(olaForm,channel,selectedCategory);clearErrors(olaForm);}
jQuery('.categorySelect').trigger('enable-vehicle-details');});$('.subcategorySelect').change(function(e){e.preventDefault();jQuery('.subcategorySelect').trigger('enable-vehicle-details');});initFormForCategory();};namespace("ct1.ola");ct1.ola.checkout=function(){var staticContentServerUrl;var serverUrl;function initStaticUrl(){staticContentServerUrl=jQuery("input[name='staticContentServerUrl']").attr("value");serverUrl=jQuery("input[name='serverUrl']").attr("value");}
jQuery('#o_ksb_continue').live("click",function(e){var checkoutForm=jQuery("#olaShoppingBasket");jQuery('.tncCheckbox').removeClass("error");jQuery('#kaptcha').removeClass("error");var tncCheckbox=checkoutForm.find("input[name='tncCheckbox']");var termsAgreementAccepted=tncCheckbox.attr("checked");var tncCheck=checkoutForm.find(".tncCheck");var captchaContainer=checkoutForm.find(".captchaContainer");if(termsAgreementAccepted&&jQuery('#kaptcha').val().length>0){checkoutForm.submit();return true;}else{if(!jQuery(".tncCheckbox").attr("checked")){tncCheck.addClass("tncCheckError");tncCheck.addClass("error");}
if(jQuery('#kaptcha').val().length===0){captchaContainer.addClass("error");}
return false;}});$('.completeCheckout').live("click",function(e){e.preventDefault();var checkoutForm=jQuery(this).closest("form");var tncCheck=checkoutForm.find(".tncCheck");var tncCheckbox=checkoutForm.find("input[name='tncCheckbox']");if(tncCheckbox.attr("checked")){var completeCheckoutForm=jQuery(jQuery("#completeCheckoutForm").closest("form"));completeCheckoutForm.submit();}else{tncCheck.addClass("tncCheckError");tncCheck.addClass("error");}});$('.cashEftPaymentCheckout').live("click",function(e){e.preventDefault();var checkoutForm=jQuery(this).closest("form");var cneCheck=checkoutForm.find(".cneCheck");var cneCheckbox=checkoutForm.find("input[name='cneCheckbox']");if(cneCheckbox.attr("checked")){var completeCheckoutForm=jQuery(jQuery("#olaCashEftPayment").closest("form"));completeCheckoutForm.submit();}else{cneCheck.addClass("cneCheckError");cneCheck.addClass("error");}});$('.cneCheckbox').live("click",function(e){var checkoutForm=jQuery(this).closest("form");var cneCheck=checkoutForm.find(".cneCheck");if(jQuery(this).attr("checked")){cneCheck.removeClass("cneCheckError");cneCheck.removeClass("error");}});$('.tncCheckbox').live("click",function(e){var checkoutForm=jQuery(this).closest("form");var tncCheck=checkoutForm.find(".tncCheck");if(jQuery(this).attr("checked")){tncCheck.removeClass("tncCheckError");tncCheck.removeClass("error");}});$("#deleteAdvert input[name='cancel']").live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}});$("#discountAdvert input[name='cancel']").live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}});jQuery("#o_sb_creditDebit1").click(function(){jQuery("#o_sb_paymentOption1").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption1").addClass("selected");});jQuery("#o_sb_creditDebit2").click(function(){jQuery("#o_sb_paymentOption1").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption1").addClass("selected");});jQuery("#o_sb_creditDebit3").click(function(){jQuery("#o_sb_paymentOption1").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption1").addClass("selected");});jQuery("#o_sb_creditDebit4").click(function(){jQuery("#o_sb_paymentOption1").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption1").addClass("selected");});jQuery("#o_sb_payByCash").click(function(){jQuery("#o_sb_paymentOption2").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption2").addClass("selected");});jQuery("#o_sb_EFT").click(function(){jQuery("#o_sb_paymentOption3").siblings(".selected").removeClass("selected");jQuery("#o_sb_paymentOption3").addClass("selected");});jQuery("#olaShoppingBasket #kaptchaImage").live("click",function(){if(jQuery(".lbContent").length<=0){window.location.href=serverUrl+'/ola/commerce/adverts-checkout';}else{var emailForm=$(this).closest("#emailSellerForm");$.ajax({type:"POST",url:emailForm.attr('action')+"?reset=true",cache:false,data:emailForm.serialize(),contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"text",complete:function(res){$(".lbContent").html(res.responseText);ct1.search.advert.bindEmailSubmit();var content=$(".lbContent").html()
var startIndex=content.indexOf("=",res.responseText.indexOf("captchaId"))+1;var endIndex=content.indexOf(" ",startIndex)-1;$("input[name='captchaId']").val(content.substring(startIndex,endIndex));}});}});jQuery("#olaShoppingBasket #kaptchaLabel").live("click",function(){if(jQuery(".lbContent").length<=0){window.location.href=serverUrl+'/ola/commerce/adverts-checkout';}else{var emailForm=$(this).closest("#emailSellerForm");$.ajax({type:"POST",url:emailForm.attr('action')+"?reset=true",cache:false,data:emailForm.serialize(),contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"text",complete:function(res){$(".lbContent").html(res.responseText);ct1.search.advert.bindEmailSubmit();var content=$(".lbContent").html()
var startIndex=content.indexOf("=",res.responseText.indexOf("captchaId"))+1;var endIndex=content.indexOf(" ",startIndex)-1;$("input[name='captchaId']").val(content.substring(startIndex,endIndex));}});}});initStaticUrl();}
namespace("ct1.ola");ct1.ola.discount=function(){function initDiscountForm(){jQuery('#discountAdvert').bind('submit',function(e){e.preventDefault();var discountForm=jQuery(this).closest("form")
var lbContainer=jQuery(".lbContent");var discountUri=discountForm.attr('action');var data=discountForm.serialize();lbContainer.html(jQuery('#ola-admin-lightbox-processing').html());jQuery.ajax({type:"POST",url:discountUri,data:data,cache:false,contentType:"application/x-www-form-urlencoded; charset=UTF-8",complete:function(res){if(!/olaErrorMessage/.test(res.responseText)){window.location.reload();}else{lbContainer.html(res.responseText);jQuery('#discountAdvert.form').trigger('discount-ola-lightbox-loaded');}}});});}
jQuery('#discountAdvert.form').live('discount-ola-lightbox-loaded',function(e){e.preventDefault();initDiscountForm();});}
namespace("ct1.ola");ct1.ola.manageMyAds=function(){$("#expireAdvert input[name='expire']").live('click',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");var expireReason=olaForm.find(".expireReason");if(expireReason.attr('value')!==''){olaForm.submit();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}}else{expireReason.addClass('error');}});$("#expireAdvert .expireReason").live('change',function(e){jQuery(this).removeClass('error');});$("#rebookAdvert input[name='rebook']").live('click',function(e){var rebookForm=$('#rebookAdvert');var processingHtml=$('.rebookProcessing',rebookForm).html();rebookForm.submit();$(this).closest('.lbContent').html(processingHtml);});$("#expireAdvert input[name='cancel']").live('click',function(e){e.preventDefault();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}});};namespace("ct1.ola");ct1.ola.mediaUpload=function(){var flashVersion=0;var currentImageCount=0;var staticContentServerUrl;var maxNumberOfPhotos=9;var isNewPhotoUpload=$('#o_mu_picPanel').hasClass('newPhotoUpload');function setLastVisiblePhotoContainer(value){if(window.sessionStorage){sessionStorage.setItem('lastVisiblePhotoContainer',value);}else{$.cookie("lastVisiblePhotoContainer",value,{expires:1});}}
function removeLastVisiblePhotoContainer(){if(window.sessionStorage){sessionStorage.removeItem('lastVisiblePhotoContainer');}else{$.removeCookie("lastVisiblePhotoContainer");}}
function getLastVisiblePhotoContainer(){if(window.sessionStorage){return sessionStorage.getItem("lastVisiblePhotoContainer");}else{return $.cookie("lastVisiblePhotoContainer");}}
function initFlash(){try{jQuery.flash;flashVersion=jQuery.flash.version.major;}catch(err){flashVersion=0;}}
function initImageCount(){maxNumberOfPhotos=jQuery('#o_mu_sortable').find("li").size();currentImageCount=jQuery("input[name='ola.orderedImageReferences']").size();}
function initStaticUrl(){staticContentServerUrl=jQuery("input[name='staticContentServerUrl']").attr("value");}
function initClickablePhotoContainer(){var thumbs=jQuery('.orderMid');jQuery(thumbs[0]).bind('click',function(){jQuery('#o_mu_photoSelect').click()});jQuery(thumbs[0]).addClass('clickable');}
function initButtons(){if(currentImageCount>=maxNumberOfPhotos){noMoreUploads();return;}
showUploadError();if(isNewPhotoUpload){jQuery('.olaContinue span').html(currentImageCount>0?'Continue':'SKIP');jQuery('#olaContinueTopH3').html(currentImageCount>0?'Upload more later:':'Upload later:');}
if(jQuery('#manualUploadButton').length===0){jQuery("#o_mu_manualFile").filestyle({image:staticContentServerUrl+"/web/images/ola/but_basic_browse.gif",imageheight:34,imagewidth:110,width:180,'margin-top':10});jQuery("#manualUploadButton").hover(function(){jQuery(this).css("backgroundImage","url("+staticContentServerUrl+"/web/images/ola/but_basic_browse_hover.gif)");},function(){jQuery(this).css("backgroundImage","url("+staticContentServerUrl+"/web/images/ola/but_basic_browse.gif)");});}
jQuery("#o_mu_photoSelect").removeAttr("disabled");jQuery("#o_mu_manualFile").removeAttr("disabled");jQuery("#o_mu_manualUpload").removeAttr("disabled");if(flashVersion<10){switchToStandardUpload();}else{switchToFlashUpload();}
toggleImageTip();}
function showUploadError(){var uploadError=jQuery('#o_mu_uploadError');if(uploadError.length>0){$('#o_mu_errors').html(uploadError.html()).show();uploadError.remove();}}
function noMoreUploads(){jQuery("#o_mu_disableUpload").hide();jQuery("#o_mu_deletingImage").show();jQuery("#o_mu_standardUpload").hide();jQuery("#o_mu_flashUpload").hide();jQuery("#o_mu_flashUpload_newPhotoUpload").hide();toggleImageTip();}
function toggleImageTip(){if(currentImageCount>=maxNumberOfPhotos){jQuery("#o_mu_moreImagesTip").hide();jQuery("#o_mu_lessImagesTip").show();}
else{jQuery("#o_mu_lessImagesTip").hide();jQuery("#o_mu_moreImagesTip").show();}}
function switchToFlashUpload(){if(isUploadDisabled())return;jQuery("#o_mu_disableUpload").hide();jQuery("#o_mu_deletingImage").hide();jQuery("#o_mu_standardUpload").hide();jQuery("#o_mu_flashUpload").show();jQuery("#o_mu_flashUpload_newPhotoUpload").show();}
function switchToStandardUpload(){if(isUploadDisabled())return;jQuery("#o_mu_disableUpload").hide();jQuery("#o_mu_deletingImage").hide();jQuery("#o_mu_standardUpload").show();jQuery("#o_mu_flashUpload"+(isNewPhotoUpload?'_newPhotoUpload':'')).hide();if(flashVersion==-1)return;if(flashVersion<10){jQuery("#o_mu_standardUploadInstallFlash").show();jQuery("#o_mu_standardUploadWithFlash").hide();}else{jQuery("#o_mu_standardUploadInstallFlash").hide();jQuery("#o_mu_standardUploadWithFlash").show();}}
function showFade(){if(currentImageCount==0){jQuery(".olaFadeOn").show();}else{jQuery(".olaFadeOn").hide();}}
function initSortable(){var selectedImage;jQuery('#o_mu_sortable').sortable({appendTo:'#olaMediaUpload',items:'li.o_mu_sortThis',placeholder:'o_mu_placeHolder',helper:function(event){jQuery(".primaryPic").removeClass("primaryPic");var clone=selectedImage.clone();clone.addClass("o_mu_sortDrag");clone.find("span").css("display","none");return clone;},stop:function(event){selectedImage.removeClass("o_mu_sortDrag");selectedImage.find("span").css("display","block");jQuery('#o_mu_sortable').find("li").each(function(index){var element=jQuery(this).find("span");var deleteButton=element.find("input");if(index==0){element.text("PRIMARY PHOTO");if(!element.hasClass("o_mu_picPrimary")){element.addClass("o_mu_picPrimary");}
element.parent().addClass("primaryPic");}else{var imageNumber=index+1;if(imageNumber<10)imageNumber="0"+imageNumber;element.text("PHOTO "+imageNumber);if(element.hasClass("o_mu_picPrimary")){element.removeClass("o_mu_picPrimary");}}
element.append(deleteButton);jQuery(this).find("input.o_mu_hidden").val(index+1);});if(jQuery(this).hasClass('editMode')){var self=this;var same=true;jQuery(self).data("copy").find("li").each(function(index){var copySrc=jQuery(this).find("img").attr("src");var currentSrc=$(jQuery(self).find("li")[index]).find("img").attr("src");if(copySrc!==currentSrc)
same=false;});if(!same)
jQuery(this).trigger('edit-photos-changed');}}});jQuery("#o_mu_sortable").find("li").bind("mousedown",function(){selectedImage=jQuery(this);});var copy=jQuery("#o_mu_sortable").clone();jQuery("#o_mu_sortable").data("copy",copy);}
function showPhotos(pictureFrom,pictureTo){$('#o_mu_sortable').find("li").each(function(index){if((pictureFrom<=(index+1))&&((index+1)<=pictureTo)){$(this).show();}else{$(this).hide();}});}
function updateMorePhotos(){var lastVisiblePhotoContainer=getLastVisiblePhotoContainer();var $morePhotosContainer=$(".olaMorePhotosContainer");if(lastVisiblePhotoContainer==null){lastVisiblePhotoContainer=5;setLastVisiblePhotoContainer(lastVisiblePhotoContainer);}
if(lastVisiblePhotoContainer>currentImageCount+1){showPhotos(1,lastVisiblePhotoContainer);}else{if((0<currentImageCount)&&(currentImageCount<5)){showPhotos(1,5);setLastVisiblePhotoContainer(5);}else if((5<=currentImageCount)&&(currentImageCount<10)){showPhotos(1,10);setLastVisiblePhotoContainer(10);}else if((10<=currentImageCount)&&(currentImageCount<15)){showPhotos(1,15);setLastVisiblePhotoContainer(15);}else{showPhotos(1,20);setLastVisiblePhotoContainer(20);}}
if(getLastVisiblePhotoContainer()<=15){$morePhotosContainer.show();}else{$morePhotosContainer.hide();}}
function initMediaUpload(){var olaForm=jQuery("#olaMediaUpload");if(olaForm===null||olaForm.length<1){return;}
if(jQuery(".o_mu_disableFlashUpload").length>0){flashVersion=-1;}
else{initFlash();}
initImageCount();initStaticUrl();initButtons();showFade();initSortable();if(isNewPhotoUpload){initClickablePhotoContainer();updateMorePhotos();}}
function isUploadDisabled(){return jQuery('#o_mu_upload').hasClass('o_mu_disabled');}
function bindLightboxCloseEvent(){if(jQuery("#o_mu_standardUpload_placeholder_newPhotoUpload").length){$('#lightbox').live('lightbox-closing',function(){jQuery("#o_mu_standardUpload_placeholder_newPhotoUpload").after(jQuery("#o_mu_standardUpload_wrapper"));});}}
jQuery("#o_mu_standardUploadLink").bind('click',switchToStandardUpload);jQuery("#o_mu_flashUploadLink").bind('click',switchToFlashUpload);jQuery("#o_mu_manualUpload").live('click',function(e){e.preventDefault();if(isUploadDisabled())return;var form=jQuery(jQuery(this).closest("form"));jQuery(".olaFadeOn").show();form.submit();});$('.deleteOLAMedia').die();$('.deleteOLAMedia').live('click',function(e){e.preventDefault();var form=jQuery(jQuery(this).closest("form"));form.find("input[name='ola.deleteMediaReference']").attr("value",this.name);var form=jQuery(jQuery(this).closest("form"));var mediaUploadUri=form.attr('action');jQuery.post(mediaUploadUri,form.serialize(),function(res){if(isNewPhotoUpload){var lastVisiblePhotoContainer=getLastVisiblePhotoContainer();}
form.find('#o_mu_sortable').replaceWith(jQuery(res).find('#o_mu_sortable'));if(isNewPhotoUpload){showPhotos(1,lastVisiblePhotoContainer);}
form.find("input[name='ola.deleteMediaReference']").attr("value","");initImageCount();showFade();initSortable();initButtons();initClickablePhotoContainer();});});$('.deleteOLAMediaEdit').die();$('.deleteOLAMediaEdit').live('click',function(e){e.preventDefault();var form=jQuery(jQuery(this).closest("form"));ct1.utilities.addFormField(form,{name:"mediaReferencesToDelete",value:this.name,autoList:true});jQuery(this).closest('li').remove();jQuery('#o_mu_sortable').find("li").each(function(index){var li=$(this);if(!li.hasClass("o_mu_sortThis")){var imageNumber=index+1;if(imageNumber<10)imageNumber="0"+imageNumber;li.html('<div class="orderMid">'+imageNumber+'</div>');}});var last=jQuery("<li/>").attr("class","o_mu_pic_"+maxNumberOfPhotos).html('<div class="orderMid">'+(maxNumberOfPhotos<10?"0":"")+maxNumberOfPhotos+'</div>');jQuery('#o_mu_sortable').append(last);jQuery('#o_mu_sortable').trigger('edit-photos-changed');});$('#o_mu_sortable').live('init-sortable-photos',function(){initSortable();});$('a.lightboxUploadPhotosPreview').die();$('a.lightboxUploadPhotosPreview').live('click',function(e){e.preventDefault();if(isUploadDisabled())return;$(this).trigger('go-click');});$('.olaMorePhotosContainer a#olaMorePhotosLink').die('click').live('click',function(e){e.preventDefault();var lastVisiblePhotoContainer=currentImageCount;$('#o_mu_sortable').find("li").each(function(index){if($(this).is(":visible")){lastVisiblePhotoContainer=index+1;}});setLastVisiblePhotoContainer(lastVisiblePhotoContainer+5);showPhotos(1,lastVisiblePhotoContainer+5);if(lastVisiblePhotoContainer==15){$(this).hide();}});$("button[name='initOla'], table#olaItem .o_all_editLink").live('click',function(e){removeLastVisiblePhotoContainer();});initMediaUpload();bindLightboxCloseEvent();};namespace("ct1.ola");ct1.ola.mmv=function(){var isMakeItemsShown=false;var isModelItemsShown=false;var isDerivativeItemsShown=false;var isMakeMouseOver=false;var isModelMouseOver=false;var isDerivativeMouseOver=false;var isShiftDown=false;var mmvServiceUri="/mmv-service/browse/";var olaFieldName="ola.stockItem.";var derivativeArr=["e.g. 635EK","e.g. mk111","e.g. 656"];var modelArr=["e.g. Voyager","e.g. Leven","e.g. Odyssey"];jQuery(".mmvInput").attr("autocomplete","off");jQuery(".mmvItems").attr("autocomplete","off");jQuery(".mmvItems").hide();function populateItems(mmvItems){var fullMMVUri=getMMVUri(mmvItems);var mmvType=getMMVType(mmvItems);var optionHtml="<option class=\""+mmvType+"Option\"></option>";jQuery(mmvItems).empty();jQuery.get(fullMMVUri,function(res){var options=jQuery(res).find("result").children();if(options.length>0){jQuery(mmvItems).attr('size',5);}
for(var i=0;i<options.length;i++){var option=jQuery(optionHtml);var value=jQuery(options[i]).text();option.val(value);option.text(value);mmvItems.append(option);}});}
function resetMMVDropDowns(mmvObject){var olaForm=jQuery(mmvObject).closest("form");var channel=olaForm.find("input[name='ola.channel']").attr("value");var mmvType=getMMVType(mmvObject);if((channel!='motorhome')&&(channel!='caravan')){if(mmvType==='make'){resetMMVDropDown(jQuery(".modelItems"));resetMMVDropDown(jQuery(".derivativeItems"));}else if(mmvType==='model'){resetMMVDropDown(jQuery(".derivativeItems"));}}}
function resetMMVDropDown(mmvItems){var mmvType=getMMVType(mmvItems);if(mmvType==='make'){mmvItems.val("");}else{jQuery(mmvItems).empty();jQuery(mmvItems).attr('size',2);}
var mmvInput=mmvInputFor(mmvItems);jQuery(mmvInput).val("");}
function resetMMVInputValues(mmvItems){var mmvValue=mmvTrimValue(mmvItems);var mmvDropDown=jQuery(mmvItems).closest("div");mmvItems.addClass("example");mmvItems.css({color:'#ccc'})
var mmvInput=mmvInputFor(mmvItems);jQuery(mmvInput).val("");}
function getMMVType(mmvObject){var mmvField=mmvInputFor(mmvObject);if(mmvField.length<1){mmvField=mmvObject;}
var mmvFieldName=jQuery(mmvField).attr("name");return mmvFieldName.substring(olaFieldName.length);}
function getMMVUri(mmvItems){var mmvType=getMMVType(mmvItems);var olaForm=jQuery(mmvItems).closest("form");var channel=olaForm.find("input[name='ola.channel']").val();var makeValue=olaForm.find(".makeInput").val();var modelValue=olaForm.find(".modelInput").val();var mmvUri=mmvServiceUri+channel+"/";if(mmvType==="model"){mmvUri+=makeValue;}else if(mmvType==="derivative"){mmvUri+=makeValue+"/"+modelValue;}
return mmvUri;}
function mmvInputTypeAhead(mmvInput,keyCode){var mmvItems=itemsFor(mmvInput);var enteredText=jQuery(mmvInput).val();var options=jQuery(mmvItems).children();for(var i=0;i<options.length;i++){var mmvValue=jQuery(options[i]).text();if(startsWith(mmvValue,enteredText)){mmvItems.attr("value",mmvValue);mmvItems.attr('selectedIndex',i);jQuery(mmvInput).attr("value",mmvValue);setSelectionRange(mmvInput,enteredText.length,mmvValue.length);resetMMVDropDowns(mmvInput);populateNextMMVItems(mmvItems);break;}else if(i===options.length-1){jQuery(mmvItems).attr("value","");jQuery(mmvItems).attr('selectedIndex',0);resetMMVDropDowns(mmvInput);}}}
function startsWith(text,compareText){if(text===''){return false;}
text=escape(text.toUpperCase());compareText=escape(compareText.toUpperCase());return text.startsWith(compareText);}
function moveToNextOption(mmvInput,isDown){var mmvItems=itemsFor(mmvInput);var mmvOption=mmvItems.children("option:selected");if(mmvOption.length===0){mmvOption=mmvItems.children("option:first");}else{mmvOption=isDown?mmvOption.next():mmvOption.prev();}
mmvOptionMouseOver(mmvOption);jQuery(mmvInput).val(mmvOption.val());resetMMVDropDowns(mmvInput);populateNextMMVItems(mmvItems);}
function moveToNextInput(mmvObject,isConfirmable){var mmvType=getMMVType(mmvObject);if(mmvType==="make"){isMakeItemsShown=hideItems(jQuery('.makeItems'));}else if(mmvType==="model"){isModelItemsShown=hideItems(jQuery('.modelItems'));}else if(mmvType==="manufactureYear"||mmvType==="regYear"){}else if(mmvType==="derivative"){isDerivativeItemsShown=hideItems(jQuery('.derivativeItems'));if(isConfirmable){jQuery('.mmvConfirm').click();}}}
function moveToPrevInput(mmvObject){var mmvType=getMMVType(mmvObject);if(mmvType==="model"){isModelItemsShown=hideItems(jQuery('.modelItems'));}else if(mmvType==="manufactureYear"||mmvType==="regYear"){}else if(mmvType==="derivative"){isDerivativeItemsShown=hideItems(jQuery('.derivativeItems'));}else{}}
function isValidInputKeyCode(keyCode){var isSpace=keyCode===32;var isLowercaseAlphaNumeric=keyCode>=48&&keyCode<=90;var isNumPad=keyCode>=96&&keyCode<=111;var isPunctuation=keyCode>=186&&keyCode<=192;var isOtherPunctuation=keyCode>=219&&keyCode<=222;if(isSpace||isLowercaseAlphaNumeric||isNumPad||isPunctuation||isOtherPunctuation){return true;}
return false;}
function mmvInputFocus(mmvInput,isItemsShown){var enteredText=jQuery(mmvInput).attr("value");setSelectionRange(mmvInput,0,enteredText.length);if(!isItemsShown){var mmvItems=itemsFor(mmvInput);isItemsShown=showItems(mmvItems);}
return isItemsShown;}
function mmvInputBlur(mmvInput,isMouseOver,isItemsShown){if(!isMouseOver){var mmvItems=itemsFor(mmvInput);isItemsShown=hideItems(mmvItems);}
return isItemsShown;}
function mmvItemsBlur(mmvItems,isMouseOver,isItemsShown){if(!isMouseOver){isItemsShown=hideItems(mmvItems);}
return isItemsShown;}
function mmvItemsChange(mmvItems){if(mmvItems.options.selectedIndex===-1){return;}
var selectedIndex=mmvItems.options.selectedIndex===-1?0:mmvItems.options.selectedIndex;var mmvOption=mmvItems.options[selectedIndex];return mmvOptionClick(mmvOption);}
function mmvOptionMouseOver(mmvOption){var selectedItem=jQuery(mmvOption).attr("value");var mmvItems=itemsFor(mmvOption);jQuery(mmvItems).attr("value",selectedItem);}
function getMMVOptionMouseOver(mmvItems,mousePosition){var optionHeight=16;var scrollPos=jQuery(mmvItems).scrollTop();var mmvItemsPos=jQuery(mmvItems).offset().top-optionHeight+1;var optionPos=mousePosition+scrollPos-mmvItemsPos;var optionIndex=Math.floor(optionPos/optionHeight)-1;optionIndex=optionIndex<0?0:optionIndex;return mmvItems.options[optionIndex];}
function mmvOptionClick(mmvOption){resetMMVDropDowns(mmvOption);var selectedItem=jQuery(mmvOption).text();var mmvInput=mmvInputFor(mmvOption);jQuery(mmvInput).val(selectedItem);var mmvItems=itemsFor(mmvOption);var isHidden=hideItems(mmvItems);populateNextMMVItems(mmvItems);return isHidden;}
function mmvPointerClick(mmvPointer,isItemsShown){var mmvItems=itemsFor(mmvPointer);if(isItemsShown){isItemsShown=hideItems(mmvItems);}else{isItemsShown=showItems(mmvItems);}
return isItemsShown;}
function itemsFor(mmvObject){var mmvDropDown=jQuery(mmvObject).closest("div");var mmvItems=jQuery(mmvDropDown).find("select");return mmvItems;}
function mmvInputFor(mmvObject){var mmvDropDown=jQuery(mmvObject).closest("div");var mmvInput=jQuery(mmvDropDown).find("input[type='text']");return mmvInput;}
function showItems(mmvItems){jQuery(mmvItems).show();return true;}
function hideItems(mmvItems){jQuery(mmvItems).hide();return false;}
function setSelectionRange(input,selectionStart,selectionEnd){if(input.setSelectionRange){input.setSelectionRange(selectionStart,selectionEnd);}
else if(input.createTextRange){var range=input.createTextRange();range.collapse(true);range.moveEnd('character',selectionEnd);range.moveStart('character',selectionStart);range.select();}}
function mmvCheckValue(mmvInput){var mmvValue=mmvTrimValue(mmvInput);var mmvDropDown=jQuery(mmvInput).closest("div");if((mmvValue==='')||(!checkModelDerivativesValues(modelArr,mmvValue))){mmvDropDown.addClass("error");}else{mmvDropDown.removeClass("error");}
return mmvValue;}
function mmvTrimValue(mmvInput){mmvInput.val(mmvInput.val().trim());return mmvInput.val();}
function space(value){if(value!==''){return' '+value;}
return value;}
function vehicleFound(olaForm,vehicleDetails){olaForm.find(".vehicleFound").removeClass("hideFindYour");olaForm.find(".vehicleNotFound").removeClass("vehicleNotFound").addClass("noVehicleNotFound");olaForm.find(".noVehicleNotFound").addClass("hideFindYour");olaForm.find(".vsMakeModel").text(vehicleDetails);olaForm.find('.mmvConfirm').trigger('enable-vehicle-details');}
function initVehicleFound(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var vsMakeModel=olaForm.find(".vsMakeModel").text();if(vsMakeModel.trim()!==''){olaForm.find(".vehicleFound").removeClass("hideFindYour");olaForm.find(".vehicleNotFound").removeClass("vehicleNotFound").addClass("noVehicleNotFound");olaForm.find(".noVehicleNotFound").addClass("hideFindYour");olaForm.find('.mmvConfirm').trigger('enable-vehicle-details');}}
function initMakeValues(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var makeItems=olaForm.find(".makeItems")
populateItems(makeItems);}
function checkModelDerivativesValues(arr,value){if($.inArray(value,arr)>-1){return false;}else{return true;}}
function populateNextMMVItems(mmvItems){var mmvInput=mmvInputFor(mmvItems);var olaForm=jQuery(mmvItems).closest("form");var channel=olaForm.find("input[name='ola.channel']").attr("value");if(mmvInput.val()===""){return;}
var mmvType=getMMVType(mmvItems);if((channel!='motorhome')&&(channel!='caravan')){if(mmvType==='make'){populateItems(jQuery('.modelItems'));}else if(mmvType==='model'){populateItems(jQuery('.derivativeItems'));}}}
$('.mmvChangeDetails').live('click',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");var channel=olaForm.find("input[name='ola.channel']").attr("value");resetMMVDropDown(jQuery('.makeItems'));if((channel!='motorhome')&&(channel!='caravan')){resetMMVDropDown(jQuery('.modelItems'));resetMMVDropDown(jQuery('.derivativeItems'));}else{resetMMVInputValues(jQuery('.modelInput'));resetMMVInputValues(jQuery('.derivativeInput'));}
isMakeItemsShown=false;isModelItemsShown=false;isDerivativeItemsShown=false;});$('.makeInput').focus(function(){isMakeItemsShown=mmvInputFocus(this,isMakeItemsShown);});$('.modelInput').focus(function(){isModelItemsShown=mmvInputFocus(this,isModelItemsShown);});$('.derivativeInput').focus(function(){isDerivativeItemsShown=mmvInputFocus(this,isDerivativeItemsShown);});$('.makeInput').blur(function(){isMakeItemsShown=mmvInputBlur(this,isMakeMouseOver,isMakeItemsShown);});$('.modelInput').blur(function(){isModelItemsShown=mmvInputBlur(this,isModelMouseOver,isModelItemsShown);});$('.derivativeInput').blur(function(){isDerivativeItemsShown=mmvInputBlur(this,isDerivativeMouseOver,isDerivativeItemsShown);});$('.makeItems').blur(function(){isMakeItemsShown=mmvItemsBlur(this,isMakeMouseOver,isMakeItemsShown);});$('.modelItems').blur(function(){isModelItemsShown=mmvItemsBlur(this,isModelMouseOver,isModelItemsShown);});$('.derivativeItems').blur(function(){isDerivativeMouseOver=mmvItemsBlur(this,isDerivativeMouseOver,isDerivativeMouseOver);});$('.makeInput,.modelInput,.derivativeInput').live('keyup',function(e){if(!isShiftDown&&e.keyCode===9){moveToNextInput(this,false);}else if(e.keyCode===13){moveToNextInput(this,true);}else if(isValidInputKeyCode(e.keyCode)){mmvInputTypeAhead(this,e.keyCode);}else if(e.keyCode===16){isShiftDown=false;}});$('.yearItems').live('keyup',function(e){e.preventDefault();if(!isShiftDown&&e.keyCode===9){moveToNextInput(this,false);}else if(e.keyCode===13){moveToNextInput(this,true);}else if(e.keyCode===16){isShiftDown=false;}});$('.mmvConfirm').live('keyup',function(e){e.preventDefault();if(e.keyCode===13){jQuery(this).click();}else if(e.keyCode===16){isShiftDown=false;}});$('.mmvConfirm').live('keydown',function(e){e.preventDefault();if(isShiftDown&&e.keyCode===9){moveToPrevInput(this);}else if(e.keyCode===16){isShiftDown=true;}});$('.yearItems').live('keydown',function(e){if(e.keyCode===9){e.preventDefault();if(isShiftDown){moveToPrevInput(this);}}else if(e.keyCode===16){isShiftDown=true;}});$('.makeInput,.modelInput,.derivativeInput').live('keydown',function(e){if(e.keyCode===9){e.preventDefault();if(isShiftDown){moveToPrevInput(this);}}else if(e.keyCode===16){isShiftDown=true;}else if(e.keyCode===38){moveToNextOption(this,false);}else if(e.keyCode===40){moveToNextOption(this,true);}});$('.modelInput,.derivativeInput').live('focus',function(e){var mmvDropDown=jQuery(this).closest("div");var mmvInput=jQuery(mmvDropDown).find("input[type='text']");mmvInput.val("");mmvInput.removeClass("example");});$('.makeItems').click(function(){isMakeItemsShown=mmvItemsChange(this);});$('.modelItems').click(function(){isModelItemsShown=mmvItemsChange(this);});$('.derivativeItems').click(function(){isDerivativeItemsShown=mmvItemsChange(this);});$('.makeDropDown').live('mouseover',function(e){e.preventDefault();isMakeMouseOver=true;});$('.modelDropDown').live('mouseover',function(e){e.preventDefault();isModelMouseOver=true;});$('.derivativeDropDown').live('mouseover',function(e){e.preventDefault();isDerivativeMouseOver=true;});$('.makeItems,.modelItems,.derivativeItems').live('mousemove',function(e){e.preventDefault();var mmvOption=getMMVOptionMouseOver(this,e.pageY)
mmvOptionMouseOver(mmvOption);});$('.makeDropDown').live('mouseout',function(e){e.preventDefault();isMakeMouseOver=false;});$('.modelDropDown').live('mouseout',function(e){e.preventDefault();isModelMouseOver=false;});$('.derivativeDropDown').live('mouseout',function(e){e.preventDefault();isDerivativeMouseOver=false;});$('.makePointer').live('click',function(e){e.preventDefault();isMakeItemsShown=mmvPointerClick(this,isMakeItemsShown);});$('.modelPointer').live('click',function(e){e.preventDefault();isModelItemsShown=mmvPointerClick(this,isModelItemsShown);});$('.derivativePointer').live('click',function(e){e.preventDefault();isDerivativeItemsShown=mmvPointerClick(this,isDerivativeItemsShown);});$('.mmvConfirm').live('click',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");var channel=olaForm.find("input[name='ola.channel']").attr("value");var isModelMandatory=channel==='van'||channel==='truck'||channel==='motorhome'||channel==='caravan'||channel==='boat'||channel==='car'||channel==='bike';var isVRMInputted=ct1.ola.vehicleDetails.isVRMInputted(olaForm);if(!isVRMInputted){olaForm.find('.olaVrm').addClass('vrmError');olaForm.find('.vrmInput').focus();}
var makeValue=mmvCheckValue(olaForm.find(".makeInput"));var modelValue=isModelMandatory?mmvCheckValue(olaForm.find(".modelInput")):mmvTrimValue(olaForm.find(".modelInput"));var derivativeValue=mmvTrimValue(olaForm.find(".derivativeInput"));if(!checkModelDerivativesValues(derivativeArr,derivativeValue)){derivativeValue='';olaForm.find(".derivativeInput").val('');}
var yearValue=olaForm.find(".yearItems").val();if((!isModelMandatory&&makeValue!=='')||(makeValue!==''&&(modelValue!==''&&(checkModelDerivativesValues(modelArr,modelValue))))){var vehicleDetails=makeValue+space(modelValue)+space(derivativeValue)+space(yearValue);vehicleFound(olaForm,vehicleDetails);if(channel==='motorhome'){olaForm.find(".o_motorhome_reg_tip").remove();}}});initMakeValues();initVehicleFound();};namespace("ct1.ola");ct1.ola.navigation=function(){var navigated=false;var olaFormIds=new Array("olaVehicleDetails","olaMediaUpload","olaPackageSelection","olaAdvertPreview","olaShoppingBasket");function initStep(){var olaForm=jQuery(".content").find("form");if(olaForm===null||olaForm.length<1){return;}
var olaStep=olaForm.find("input[name='olaStep']");if(olaStep===null||olaStep.length<1){return;}
var olaFormId=jQuery(olaForm).attr("id");for(var i=0;i<olaFormIds.length;i++){if(olaFormIds[i]===olaFormId){olaStep.attr('value',i+1);break;}}}
function initBreadCrumb(){var steps=jQuery("#o_all_stepsTop");if(steps===null||steps.length<1){return;}
var olaForm=jQuery(".content").find("form");var olaFormId=jQuery(olaForm).attr("id");steps.find(".o_all_stepOn").removeClass("o_all_stepOn");steps.find("."+olaFormId+"Nav").addClass("o_all_stepOn");steps.find("."+olaFormId+"Nav").removeClass("o_all_stepComplete");}
function moveStep(olaForm,amount,isUp){if(navigated){return;}
var olaStep=olaForm.find("input[name='olaStep']");var step=parseInt(olaStep.val());if(isUp&&!navigated){olaStep.attr('value',step+amount);}else if(!navigated){olaStep.attr('value',step-amount);}
navigated=true;olaForm.submit();}
jQuery('.o_all_stepComplete').live("click",function(e){e.preventDefault();var olaForm=jQuery(".content").find("form");var olaFormId=jQuery(olaForm).attr("id");if(olaFormId=='olaVehicleDetails'){var notFoundClass=olaForm.find(".olaFadeOn");if(notFoundClass.length>0){jQuery('.mmvConfirm').click();return;}}
var step=jQuery(this).attr('id').replace('o_all_step','');var olaStep=olaForm.find("input[name='olaStep']");olaStep.attr('value',step);olaForm.submit();});jQuery('.olaContinue').live("click",function(e){e.preventDefault();if($('span',$(this)).text().toLowerCase()=='skip'){$("#resetImageUpload").click();}
var olaForm=jQuery(this).closest("form");moveStep(olaForm,1,true);});jQuery('.olaPrevious').live("click",function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");moveStep(olaForm,1,false);});initStep();initBreadCrumb();};namespace("ct1.ola");ct1.ola.packageSelection=function(){function clearComerceItem(clickedItem,paramClassName){var olaForm=jQuery(clickedItem).closest("form");olaForm.find("."+paramClassName).attr("value","");}
function setComerceItem(buttonClicked,className,paramClassName){var olaForm=jQuery(buttonClicked).closest("form");jQuery(buttonClicked).closest("span").hide();olaForm.find("."+className+"Selected").show();olaForm.find("."+paramClassName).attr("value",jQuery(buttonClicked).attr("name"));}
function setAddOnItem(clickedItem,paramClassName){var olaForm=jQuery(clickedItem).closest("form");olaForm.find("."+paramClassName).attr("value",jQuery(clickedItem).attr("name"));}
function unselectButton(buttonClicked,className){var olaForm=jQuery(buttonClicked).closest("form");olaForm.find("."+className+"Selected").hide();var unselectedButton=olaForm.find("."+className);jQuery(unselectedButton).closest("span").show();}
function unselectCheckbox(buttonClicked,className){var olaForm=jQuery(buttonClicked).closest("form");olaForm.find("."+className).attr('checked',false);}
function togglePackage(packageClassName,unselectPackageClassName){jQuery("."+unselectPackageClassName).removeClass("selectedPackage").addClass("unselectedPackage");jQuery("."+packageClassName).removeClass("unselectedPackage").addClass("selectedPackage");jQuery("."+packageClassName+" .pbRightsec").addClass('rUnSelected');jQuery("."+unselectPackageClassName+".pbRightsec").addClass('rUnSelected');}
function enablePromoPackage(promotionButton){clearComerceItem(promotionButton,"packageId");clearComerceItem(promotionButton,"addOnId");togglePackage("promotionPackage","webOnlyPackage");togglePackage("promotionPackage","magAndWebPackage");unselectButton(promotionButton,"webStandard");unselectButton(promotionButton,"magAndWebStandard");unselectCheckbox(promotionButton,"webAddOn");unselectCheckbox(promotionButton,"magAndWebAddOn");setComerceItem(promotionButton,"promotionStandard","packageId");$(".magAndWebPackage .pbRightsec").addClass('rUnSelected');$(".webOnlyPackage .pbRightsec").addClass('rUnSelected');}
function enableMagAndWeb(magAndWebButton){clearComerceItem(magAndWebButton,"packageId");clearComerceItem(magAndWebButton,"addOnId");togglePackage("magAndWebPackage","webOnlyPackage");togglePackage("magAndWebPackage","promotionPackage");unselectButton(magAndWebButton,"webStandard");unselectButton(magAndWebButton,"promotionStandard");unselectCheckbox(magAndWebButton,"webAddOn");setComerceItem(magAndWebButton,"magAndWebStandard","packageId");$(".webOnlyPackage .pbRightsec").addClass('rUnSelected');$("div.standoutOptions").show();}
function enableWebOnly(webOnlyButton){clearComerceItem(webOnlyButton,"packageId");clearComerceItem(webOnlyButton,"addOnId");togglePackage("webOnlyPackage","magAndWebPackage");togglePackage("webOnlyPackage","promotionPackage");unselectButton(webOnlyButton,"promotionStandard");unselectButton(webOnlyButton,"magAndWebStandard");unselectCheckbox(webOnlyButton,"magAndWebAddOn");setComerceItem(webOnlyButton,"webStandard","packageId");$(".magAndWebPackage .pbRightsec").addClass('rUnSelected');$("div.standoutOptions").show();}
function initPackage(){var olaForm=jQuery("#olaPackageSelection");if(olaForm===null||olaForm.length<1){return;}
var packageId=olaForm.find(".packageId").val();var addOnId=olaForm.find(".addOnId").val();if(addOnId!==''){var addOnCheckbox=olaForm.find("input[name='"+addOnId+"']");addOnCheckbox.attr('checked',true);toggleAddOn(addOnCheckbox);}else if(packageId!==''){var packageButton=olaForm.find("button[name='"+packageId+"']");if(packageButton.hasClass('webStandard')){enableWebOnly(packageButton);}
else if(packageButton.hasClass('promotionStandard')){enablePromoPackage(packageButton);}
else{enableMagAndWeb(packageButton);}}else{enableMagAndWeb(olaForm.find('.magAndWebStandard'));}}
function initPackageForm(){var olaForm=jQuery("#olaPackageSelection");if(olaForm===null||olaForm.length<1){return;}
var packageIdField=olaForm.find(".packageId");var packageId=packageIdField.val();var vehiclePrice=olaForm.find('input[name="vehiclePrice"]').val();var bargainPackage=olaForm.find(".bargainPackage");var magAndWebPackage=olaForm.find(".magAndWebPackage:not(.bargainPackage)");var webOnlyPackage=olaForm.find(".webOnlyPackage:not(.bargainPackage)");var magAndWebPackageId=magAndWebPackage.find(".magAndWebStandard").attr("name");var webOnlyPackageId=webOnlyPackage.find(".webStandard").attr("name");var magAndWebBargainPackageId=bargainPackage.find(".magAndWebStandard").attr("name");var webOnlyBargainPackageId=bargainPackage.find(".webStandard").attr("name");if(vehiclePrice<5000&&bargainPackage.length>0){magAndWebPackage.hide();webOnlyPackage.hide();bargainPackage.show();if(packageId===magAndWebPackageId){packageIdField.attr("value",magAndWebBargainPackageId);}else if(packageId===webOnlyPackageId){packageIdField.attr("value",webOnlyBargainPackageId);}}else{bargainPackage.hide()
magAndWebPackage.show();webOnlyPackage.show();if(packageId===magAndWebBargainPackageId){packageIdField.attr("value",magAndWebPackageId);}else if(packageId===webOnlyBargainPackageId){packageIdField.attr("value",webOnlyPackageId);}}}
function toggleAddOn(addOn){if(addOn.hasClass('magAndWebAddOn')){toggleMagAndWebAddOn(addOn);}else{toggleWebAddOn(addOn);}}
function toggleMagAndWebAddOn(magAndWebAddOn){if(jQuery(magAndWebAddOn).attr('checked')){enableMagAndWeb(jQuery('.magAndWebStandard'));jQuery(".magAndWebPackage .pbRightsec").removeClass('rUnSelected');$(".webOnlyPackage .pbRightsec").addClass('rUnSelected');setAddOnItem(magAndWebAddOn,"addOnId");}else{jQuery(".magAndWebPackage .pbRightsec").addClass('rUnSelected');clearComerceItem(magAndWebAddOn,"addOnId");}}
function toggleWebAddOn(webAddOn){if(jQuery(webAddOn).attr('checked')){enableWebOnly(jQuery('.webStandard'));jQuery(".webOnlyPackage .pbRightsec").removeClass('rUnSelected');$(".magAndWebPackage .pbRightsec").addClass('rUnSelected');setAddOnItem(webAddOn,"addOnId");}else{jQuery(".webOnlyPackage .pbRightsec").addClass('rUnSelected');clearComerceItem(webAddOn,"addOnId");}}
$('#olaPackageSelection .magAndWebStandard').live('click',function(e){e.preventDefault();enableMagAndWeb(this);});$('#olaPackageSelection .magAndWebAddOn').live('click',function(){toggleMagAndWebAddOn(this);});$('#olaPackageSelection .webStandard').live('click',function(e){e.preventDefault();enableWebOnly(this);});$('#olaPackageSelection .webAddOn').live('click',function(){toggleWebAddOn(this);});$('#olaPackageSelection .promotionStandard').live('click',function(e){e.preventDefault();enablePromoPackage(this);});initPackageForm();initPackage();};namespace("ct1.ola");ct1.ola.closeLightbox=function(){if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}}
ct1.ola.previewEdit=function(){var isInTextError=false;var maxMagTextLength=288;var maxWebTextLength=1500;var styleDivId;var selectedStyleDivId='';var currentMagMaxLength=0;ct1.ola.previewEdit.changeStyle=function(maxTextLength,styleId){var maxCharacters=0;jQuery('.magAdPreview').attr("id",'ab-magStyle'+styleId);document.getElementById("photoImg1").className="photoImg1";document.getElementById("photoImg2").className="photoImg2";document.getElementById("photoImg3").className="photoImg3";jQuery("#o_wp_magSelect"+selectedStyleDivId).removeClass();jQuery("#o_wp_magSelect"+styleId).addClass('o_wp_magSelect'+styleId+'_on');var magText=jQuery("#hiddenMagAdvertText").val();var magCoreText=jQuery(".magCoreText").text().length;var mmvYearText=jQuery(".mmvValue").html().length;var magFreetextLength=0;magFreetextLength=magText.length;var maxLengthForFreetext=maxTextLength;if(styleId==='11'){maxCharacters=maxLengthForFreetext-magCoreText-mmvYearText;}else{maxCharacters=maxLengthForFreetext-magCoreText;}
currentMagMaxLength=maxLengthForFreetext;var magTextMessage=jQuery("#olaAdvertPreview #magTextMessage");if(maxCharacters<magFreetextLength)
{if(styleId=='11')
{jQuery('#magKeyWords1').html(magText.substring(0,maxCharacters));}
else
{jQuery('#magKeyWords').html(magText.substring(0,maxCharacters));}
jQuery('#magTextMessage').css("display",'block');jQuery('#o_mu_countError').css("display",'block');}else
{jQuery('#magTextMessage').css("display",'none');jQuery('#o_mu_countError').css("display",'none');jQuery('#magKeyWords1').html(magText);jQuery('#magKeyWords').html(magText);}
selectedStyleDivId=styleId;};function submitPreviewEdit(formId){jQuery('#'+formId).bind('submit',function(e){e.preventDefault();var self=this;var form=jQuery(this).closest('form');var isUpdate=false;if(form.find("input[name='command']").attr("value").equalsIgnoreCase("update"))
isUpdate=true;if(isUpdate)showUpdatingMessage(self);var vehicleDetailsUri=form.attr('action');var params=form.serializeArray();var channel=form.find("input[name='ola.channel']").attr("value");var category=form.find("input[name='olacategory']").attr("value");var previewEvent=form.find("input[name='previewEvent']").attr("value");var magCoreLength=0;magCoreLength=getMagCoreTextValue(magCoreLength);var magTextLength=form.find("textarea[name='ola.magDescription']").attr("value");var magTextValue=0;if(magTextLength!=undefined){magTextValue=magTextLength.length;}else{magTextValue=0;}
if(category!==''&&previewEvent!='validate-mag'){previewEvent=setSubmitName(previewEvent,channel,category);}
params.push({name:'_eventName',value:previewEvent});params.push({name:'magCoreLength',value:magCoreLength});params.push({name:'magTextLength',value:magTextValue});params.push({name:'maxMagTextLength',value:maxMagTextLength});jQuery.post(vehicleDetailsUri,params,function(res,httpResponseStatus,httpResponse){var advertPreviewResponse='';advertPreviewResponse=res;if(!/olaErrorMessage/.test(advertPreviewResponse)){jQuery('.pagePreview').replaceWith(jQuery(advertPreviewResponse).find('.pagePreview'));jQuery('.listingPreview').replaceWith(jQuery(advertPreviewResponse).find('.listingPreview'));jQuery('.magPreview').replaceWith(jQuery(advertPreviewResponse).find('.magPreview'));if(/redirect-to-page/.test(advertPreviewResponse)){ct1.ola.closeLightbox();window.location.href=advertPreviewResponse.replace('redirect-to-page|','');}
initCheckMagText();initEditMagStyles();jQuery('.magAdPreview').attr("id",'ab-magStyle'+styleDivId);if(jQuery('#lightbox').length>0){if(isUpdate)
showEditSuccessMessage(self);else
ct1.ola.closeLightbox();}}else{form.parent().html(advertPreviewResponse);if(formId==='olaMagDescription'){var magAdText=0;magAdText=getMagCoreTextValue(magAdText);jQuery('.descriptionTextArea').counter(maxMagTextLength-magAdText,setMagErrorState);}else if(formId==='olaVehicleDetailsPreview'){jQuery('.descriptionTextArea').counter(maxWebTextLength,setWebErrorState);}
submitPreviewEdit(formId);}});});}
function initEditMagStyles(){var olaForm=jQuery("#olaAdvertPreview");if(olaForm===null||olaForm.length<1){return;}
setEditMagStyles(olaForm);}
function setEditMagStyles(olaForm){if(typeof(selectedStyleDivId)==='undefined'||selectedStyleDivId===''){return;}
styleDivId=selectedStyleDivId;maxMagTextLength=currentMagMaxLength;var magazineUpgrades=olaForm.find("input[name=ola.magazineUpgradeId]");for(var i=0;i<magazineUpgrades.length;i++){jQuery(magazineUpgrades[i]).removeAttr("checked");var radioButtonId=jQuery(magazineUpgrades[i]).attr("id");var spotValue=radioButtonId.replace("o_wp_magAd","");if(spotValue===selectedStyleDivId){jQuery(magazineUpgrades[i]).attr("checked","checked");}}
ct1.ola.previewEdit.changeStyle(currentMagMaxLength,selectedStyleDivId);}
function initMagStyles(){var olaForm=jQuery("#olaAdvertPreview");if(olaForm===null||olaForm.length<1){return;}
setMagStyles(olaForm);}
function setMagStyles(olaForm){var magazineUpgrades=olaForm.find("input[name=ola.magazineUpgradeId]");for(var i=0;i<magazineUpgrades.length;i++){var magazineLabel=jQuery(magazineUpgrades[i]).parent();var magazineClass=magazineLabel.parent().attr("class");var radioButtonCheck=jQuery(magazineUpgrades[i]).attr("checked");var radioButtonId=jQuery(magazineUpgrades[i]).attr("id");if(radioButtonCheck){var spotValue=radioButtonId.replace("o_wp_magAd","");var maxChars=magazineLabel.attr("id");ct1.ola.previewEdit.changeStyle(maxChars,spotValue);}}}
function showUpdatingMessage(form){$('.olaEditUpdatingMessage').remove();var updatingMessage=$('.olaEditUpdatingMessageContent').clone();$(updatingMessage).removeClass('olaEditUpdatingMessageContent');$(updatingMessage).addClass('olaEditUpdatingMessage');$(updatingMessage).insertBefore(form);$("select",form).hide();var lb=$(".lbContent");$(updatingMessage).css({width:(lb.width()+10)+"px",height:(lb.height()+10)+"px"});$(updatingMessage).removeClass('hidden');}
function showEditSuccessMessage(form){$('.olaEditUpdatingMessage').remove();$('.olaEditUpdateSuccessMessage').remove();var updatingMessage=isMagTextError()?$('.olaEditUpdateSuccessMagTextErrorContent').clone():$('.olaEditUpdateSuccessMessageContent').clone();$(updatingMessage).removeClass('olaEditUpdateSuccessMessageContent');$(updatingMessage).addClass('olaEditUpdateSuccessMessage');$(updatingMessage).insertBefore(form);var lb=$(".lbContent");jQuery(".lightboxedit").addClass("hidden");$(updatingMessage).css({width:"100%"});$('a.olaEditUpdateSuccessClose',updatingMessage).click(function(e){e.preventDefault();ct1.ola.closeLightbox();checkLighBoxMagText();});$(updatingMessage).removeClass('hidden');}
function isMagTextError(){return $('#olaAdvertPreview #magTextMessage').is(':visible');}
function checkLighBoxMagText(){if(isMagTextError()){$('a.lightboxOlaMagDescription').trigger('mag-length-error');}}
function checkMagText(){if(isMagTextError()){$('#o_mu_countError').removeClass('hidden');return false;}else{if(!($('#o_mu_countError').hasClass('hidden'))){$('#o_mu_countError').addClass('hidden');}
return true;}}
function initCheckMagText(){var magTextMessage=jQuery("#olaAdvertPreview #magTextMessage");if(magTextMessage===null||magTextMessage.length<1){return;}
var magCoreText=0;magCoreText=getMagCoreTextValue(magCoreText);var magDescription=jQuery("#hiddenMagAdvertText").val();maxMagTextLength=currentMagMaxLength;if((maxMagTextLength-magCoreText-magDescription.length)<0){magTextMessage.show();}else{magTextMessage.hide();}}
jQuery('#olaMagDescription input[name="validate"]').live('click',function(){if(jQuery('.magAdField:visible').length>0){var adTypeId=jQuery('input:radio[name=ola.magazineUpgradeId]:checked').val();jQuery('#hiddenAdTypeId').val(adTypeId);styleDivId=selectedStyleDivId;maxMagTextLength=currentMagMaxLength;ct1.ola.previewEdit.changeStyle(currentMagMaxLength,selectedStyleDivId);}});jQuery('#olaVehicleDetailsPreview input[name="validate"]').live('click',function(){if(jQuery('.webAdField:visible').length>0){if(typeof(selectedStyleDivId)==='undefined'||selectedStyleDivId===''){return;}
var adTypeId=jQuery('input:radio[name=ola.magazineUpgradeId]:checked').val();jQuery('#hiddenAdTypeId').val(adTypeId);styleDivId=selectedStyleDivId;maxMagTextLength=currentMagMaxLength;ct1.ola.previewEdit.changeStyle(currentMagMaxLength,selectedStyleDivId);}});function submitEdit(olaForm){var textArea=olaForm.find('.descriptionTextArea');if(isInTextError){olaForm.find('.errorDisplay').show();textArea.addClass('error');e.preventDefault();}else{olaForm.find('.errorDisplay').hide();textArea.removeClass('error');olaForm.submit();}}
setMagErrorState=function(inError){var magForm=jQuery('#olaMagDescription');var textArea=magForm.find('.descriptionTextArea');isInTextError=inError;if(inError){magForm.find('.characterCountDisplay').addClass('countError');}else{magForm.find('.errorDisplay').hide();textArea.removeClass("error");magForm.find('.characterCountDisplay').removeClass('countError');}}
setWebErrorState=function(inError){var charCounter=jQuery('#olaVehicleDetailsPreview .characterCountDisplay');isInTextError=inError;if(inError){charCounter.addClass('countError');}else{charCounter.removeClass('countError');}}
jQuery('.lightboxOlaVdPreview').live('ola-vd-preview-lightbox-loaded',function(e){submitPreviewEdit('olaVehicleDetailsPreview');jQuery('#olaVehicleDetailsPreview .descriptionTextArea').counter(maxWebTextLength,setWebErrorState);enableMotOnDelivery();});jQuery('.lightboxOlaPhotosPreview').live('ola-photos-preview-lightbox-loaded',function(e){jQuery('.lightboxUploadPhotos').addClass("lightboxUploadPhotosPreview").removeClass("lightboxUploadPhotos").unbind();ct1.ola.mediaUpload();});jQuery('.lightboxOlaMagDescription').live('ola-mag-description-lightbox-loaded',function(e){submitPreviewEdit('olaMagDescription');var magAdText=0;magAdText=getMagCoreTextValue(magAdText);maxMagTextLength=currentMagMaxLength;jQuery('#olaMagDescription .descriptionTextArea').counter(maxMagTextLength-magAdText,setMagErrorState);});function getMagCoreTextValue(magAdText){if(typeof(selectedStyleDivId)==='undefined'||selectedStyleDivId===''){return 0;}
if(selectedStyleDivId==='11'){var magtext=jQuery("#olaAdvertPreview .magCoreText").text();var mmvValue=jQuery("#olaAdvertPreview .mmvValue").html();if(null===mmvValue){return 0;}else{return magAdText=magtext.length+mmvValue.length;}}else{return magAdText=jQuery("#olaAdvertPreview .magCoreText").text().length;}}
function initPhotoLightBox(){if($('.initLightBoxForPhotos').length>0)
$('.lightboxOlaPhotosPreview').trigger('auto-click');}
jQuery('#olaMagDescription input[name="cancel"]').live('click',function(){if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}});jQuery('#olaVehicleDetailsPreview input[name="cancel"]').live('click',function(){if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}});jQuery('.whiBut.editPhotos[name="reset"]').live('click',function(){var buttonsDiv=jQuery('.editPhotosButtons .resetButton');if(!buttonsDiv.hasClass('o_mu_disabled')){var oldSortable=jQuery("#o_mu_sortable").data("copy");jQuery("#o_mu_sortable").html(oldSortable.html());buttonsDiv.addClass('o_mu_disabled');jQuery("#o_mu_upload").removeClass('o_mu_disabled');jQuery('#o_mu_sortable').trigger('init-sortable-photos');jQuery('.editPhotosMessageArea').html("");}});jQuery('.whiBut.editPhotos[name="continue"]').live('click',function(){var form=jQuery('#olaMediaUpload');if(form.length>0){ct1.utilities.addFormField(form,{name:"command",value:"continue"});form.submit();}});jQuery('.whiBut.editPhotos[name="update"]').live('click',function(){var form=jQuery('#olaMediaUpload');if(form.length>0){ct1.utilities.addFormField(form,{name:"command",value:"update"});showUpdatingMessage(form);form.submit();}});jQuery('#o_mu_sortable').live('edit-photos-changed',function(){jQuery('.editPhotosButtons .resetButton').removeClass('o_mu_disabled');jQuery('.editPhotosMessageArea').html('<div class="error">Warning - You have unsaved changes scroll down to save your changes or cancel</div>');jQuery("#o_mu_upload").addClass('o_mu_disabled');});jQuery('.o_mu_disabled').live('click',function(){});function setSubmitName(previewEvent,channel,category){if(channel==='truck'||channel==='caravan'){return"validate-"+formatCategory(category);}else{return previewEvent;}}
function formatCategory(category){return category.replace(/\s/g,'').toLowerCase();}
jQuery('#olaAdvertPreview').submit(function(){var magCoreLength=0;var magMaxLength=0;if(typeof(currentMagMaxLength)==='undefined'){magMaxLength=0;}else{magMaxLength=currentMagMaxLength;}
magCoreLength=getMagCoreTextValue(magCoreLength);var form=jQuery('#olaAdvertPreview');if(form.length>0){ct1.utilities.addFormField(form,{name:"magCoreLength",value:magCoreLength});ct1.utilities.addFormField(form,{name:'maxMagTextLength',value:magMaxLength});}});jQuery('#olaVehicleDetailsPreview input[name="ola.stockItem.isMotOnDelivery"]').live('click',function(){enableMotOnDelivery();});function enableMotOnDelivery(){var olaForm=jQuery('#olaVehicleDetailsPreview');if(olaForm.length>0){var motOnDeliveryCheckbox=olaForm.find("input[name='ola.stockItem.isMotOnDelivery']");if(motOnDeliveryCheckbox.attr("checked")){$('#motYearMonthControl').val('');$('#motYearMonthControl').attr("readonly","readonly");}else{$('#motYearMonthControl').removeAttr("readonly");}}}
initMagStyles();initCheckMagText();initPhotoLightBox();ct1.utilities.trackFormChanges('#olaAdvertPreview');checkMagText();};namespace("ct1.ola");ct1.ola.standOutSelection=function(){function clearComerceItem(olaForm,paramClassName){olaForm.find("."+paramClassName).attr("value","");}
function toggleStandOut(olaForm,chosenStandOut,nonChosenStandOut1,nonChosenStandOut2){clearComerceItem(olaForm,"colourwashId");clearComerceItem(olaForm,"featuredListingId");jQuery("."+chosenStandOut+"StandOut").removeClass('unselectedExtra').addClass("selectedExtra");jQuery("."+nonChosenStandOut1+"StandOut").removeClass('selectedExtra').addClass("unselectedExtra");jQuery("."+nonChosenStandOut2+"StandOut").removeClass('selectedExtra').addClass("unselectedExtra");olaForm.find("."+nonChosenStandOut1).attr("checked",false);olaForm.find("."+nonChosenStandOut2).attr("checked",false);setClearStandOut(olaForm,false);}
function initStandOut(){var olaForm=jQuery("#olaPackageSelection");if(olaForm===null||olaForm.length<1){return;}
var colourwashId=olaForm.find(".colourwashId").attr("value");var featuredId=olaForm.find(".featuredListingId").attr("value");if(colourwashId!==""&&featuredId!==""){initColour(olaForm,"combinedColour",colourwashId);selectCombinedColour(olaForm);}else if(colourwashId!==""){initColour(olaForm,"colourwashColour",colourwashId);selectColourwashColour(olaForm);}else if(featuredId!==""){olaForm.find(".featuredListing").attr("checked",true);selectFeaturedListing(olaForm)}}
function uncheckColourSet(olaForm){olaForm.find("input[name=colourwashColour]").attr("checked",false);olaForm.find("input[name=combinedColour]").attr("checked",false);}
function initColourSet(olaForm,radioSetName){var radioSet=olaForm.find("input[name="+radioSetName+"]");jQuery(radioSet[0]).attr("checked",true);}
function initColour(olaForm,radioSetName,initColourwashId){var radioSet=olaForm.find("input[name="+radioSetName+"]");for(var i=0;i<radioSet.length;i++){var colourwashId=jQuery(radioSet[i]).attr("value");if(initColourwashId===colourwashId){jQuery(radioSet[i]).attr("checked",true);break;}}}
function toggleColourRadio(olaForm,radioSetName,otherRadioSetName){var radioSet=jQuery("#olaPackageSelection input[name="+radioSetName+"]");var otherRadioSet=jQuery("#olaPackageSelection input[name="+otherRadioSetName+"]:checked");var otherColourwashId=jQuery(otherRadioSet).attr("value");if(otherColourwashId!==undefined){jQuery(otherRadioSet).attr("checked",false);for(var i=0;i<radioSet.length;i++){var colourwashId=jQuery(radioSet[i]).attr("value");if(otherColourwashId===colourwashId){jQuery(radioSet[i]).click();break;}}}else{initColourSet(olaForm,radioSetName);}}
function setClearStandOut(olaForm,isToClear){var clearStandOut=olaForm.find("input[name=ola.clearStandOut]");jQuery(clearStandOut).attr("value",isToClear);}
function setColourwashId(olaForm,radioSetName){var selectedColour=olaForm.find("input[name="+radioSetName+"]:checked");var colourwashId=jQuery(selectedColour).attr("value");olaForm.find(".colourwashId").attr("value",colourwashId);}
function setFeaturedListingId(olaForm){var featuredListingButton=olaForm.find(".featuredListing");var featuredListingId=jQuery(featuredListingButton).attr("name");olaForm.find(".featuredListingId").attr("value",featuredListingId);}
function selectCombinedColour(olaForm){if(olaForm.find(".combinedStandOut").hasClass("unselectedExtra")){toggleStandOut(olaForm,"combined","colourwash","featuredListing");olaForm.find(".combined").attr("checked",true);}
olaForm.find("input[name=colourwashColour]:checked").attr("checked",false);setColourwashId(olaForm,"combinedColour");setFeaturedListingId(olaForm);}
function selectColourwashColour(olaForm){if(olaForm.find(".colourwashStandOut").hasClass("unselectedExtra")){toggleStandOut(olaForm,"colourwash","featuredListing","combined");olaForm.find(".colourwash").attr("checked",true);}
olaForm.find("input[name=combinedColour]:checked").attr("checked",false);setColourwashId(olaForm,"colourwashColour");}
function selectFeaturedListing(olaForm){if(olaForm.find(".featuredListing").attr('checked')){toggleStandOut(olaForm,"featuredListing","colourwash","combined");setFeaturedListingId(olaForm);uncheckColourSet(olaForm);}else{olaForm.find(".featuredListingStandOut").removeClass('selectedExtra').addClass("unselectedExtra");clearComerceItem(olaForm,"featuredListingId");setClearStandOut(olaForm,true);}}
$('#olaPackageSelection .colourwash').live('click',function(e){var olaForm=jQuery(this).closest("form");if(jQuery(this).attr('checked')){toggleStandOut(olaForm,"colourwash","featuredListing","combined");toggleColourRadio(olaForm,"colourwashColour","combinedColour");setColourwashId(olaForm,"colourwashColour");}else{olaForm.find("input[name=colourwashColour]:checked").attr("checked",false);jQuery(".colourwashStandOut").removeClass('selectedExtra').addClass("unselectedExtra");clearComerceItem(olaForm,"colourwashId");setClearStandOut(olaForm,true);}});$('#olaPackageSelection .featuredListing').live('click',function(){var olaForm=jQuery(this).closest("form");selectFeaturedListing(olaForm);});$('#olaPackageSelection .combined').live('click',function(e){var olaForm=jQuery(this).closest("form");if(jQuery(this).attr('checked')){toggleStandOut(olaForm,"combined","colourwash","featuredListing");toggleColourRadio(olaForm,"combinedColour","colourwashColour");setColourwashId(olaForm,"combinedColour");setFeaturedListingId(olaForm);}else{olaForm.find("input[name=combinedColour]:checked").attr("checked",false);olaForm.find(".combinedStandOut").removeClass('selectedExtra').addClass("unselectedExtra");clearComerceItem(olaForm,"colourwashId");clearComerceItem(olaForm,"featuredListingId");setClearStandOut(olaForm,true);}});$('#olaPackageSelection input[name=colourwashColour]').live('click',function(e){var olaForm=jQuery(this).closest("form");selectColourwashColour(olaForm);});$('#olaPackageSelection input[name=combinedColour]').live('click',function(e){var olaForm=jQuery(this).closest("form");selectCombinedColour(olaForm);});initStandOut();};namespace("ct1.ola");ct1.ola.vehicleDetails=function(){var tabKeyCode=9;function changeMagazineUpgrade(olaForm){var hiddenMagUpgrade=olaForm.find("input[name=ola.magazineUpgradeId][type=hidden]");hiddenMagUpgrade.val('magazineUpgrade.magUpgrade1');}
function changeClassCode(olaForm){var hiddenClassCode=olaForm.find('#classCode');hiddenClassCode.val('');}
function checkLocality(olaForm){var vehicleFinder=olaForm.find('.vehicleFinder');var longitude=olaForm.find('.longitude');var latitude=olaForm.find('.latitude');var errorMessage=olaForm.find('.errorMessage');var countyName=olaForm.find('.countyName');if(longitude.val()===''||latitude.val()===''){vehicleFinder.attr('value',"");}
if(errorMessage.text()==='Location not found'){vehicleFinder.attr('value',"");countyName.attr('value',"");}}
function clearDescription(olaForm){var descTxt=olaForm.find('.descTxt');var description=descTxt.text();var innerText=olaForm.find('.innerText').text();if(description===innerText){descTxt.text('');}}
function disableCounty(olaForm){var errors=olaForm.find('.olaerror');if(null!=errors&&errors.length!=0){var countyValue=olaForm.find('.countyName').val();if(countyValue===''){olaForm.find("#o_vd_county_select").show();olaForm.find("#o_vd_county_text").hide();}else{olaForm.find("#o_vd_county_text").show();olaForm.find('.countyName').attr("readonly",true);olaForm.find("#o_vd_county_select").hide();}}else{olaForm.find("#o_vd_county_text").show();olaForm.find('.countyName').attr("readonly",true);olaForm.find("#o_vd_county_select").hide();}}
function enableDisableCounty(olaForm){var countyValue=olaForm.find(".countyName").val();if(countyValue===""){olaForm.find("#o_vd_county_text").hide();olaForm.find("#o_vd_county_select").show();}else{olaForm.find("#o_vd_county_select").hide();olaForm.find("#o_vd_county_text").show();olaForm.find('.countyName').attr("readonly",true);}}
function enableDealerName(olaForm){var dealerNameWrapper=olaForm.find(".dealerNameWrapper");var dealerName=olaForm.find(".dealerName");var sellerType=olaForm.find("input[name=ola.sellerType]:checked").attr("value");if(sellerType==="private"){dealerNameWrapper.hide();dealerName.attr("value","");}else{olaForm.find(".tradeSellerType").attr("checked","checked");dealerNameWrapper.show();}}
function enableInput(field){var olaForm=jQuery(field).closest("form");setFade(olaForm);}
function enableMMVInput(field){var olaForm=jQuery(field).closest("form");setMMVFade(olaForm);}
function enableMotOnDelivery(olaForm){var motOnDeliveryCheckbox=olaForm.find("input[name='ola.stockItem.isMotOnDelivery']");if(motOnDeliveryCheckbox.attr("checked")){$('#motYearMonthControl').val('');$('#motYearMonthControl').attr("readonly","readonly");}else{$('#motYearMonthControl').removeAttr("readonly");}}
function initEmail(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var emailInAd=olaForm.find('.emailInAd');olaForm.find('.includeEmailInAd').attr('checked',emailInAd.val()!='');}
function initEnableInput(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
setFade(olaForm);setMMVFade(olaForm);enableDealerName(olaForm);enableMotOnDelivery(olaForm);}
function initLocation(){var olaForm=jQuery("#olaVehicleDetails");jQuery("#o_vd_town").locationWidget({onSelectLocation:function(userLocation){setLocationHiddenFields(userLocation);},syncWithCookie:false});enableDisableCounty(olaForm);}
function initMOT(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var motOnDelivery=olaForm.find('.motOnDelivery');olaForm.find('.isMotOnDelivery').attr('checked',motOnDelivery.val()=='true');}
function isCategorySelected(olaForm){if(olaForm.find(".category").length>0&&!isSelected(olaForm,"ola.stockItem.category")){return false;}
if(olaForm.find(".subcategory").length>0&&!isSelected(olaForm,"ola.stockItem.subCategory")){return false;}
return true;}
function isSelected(olaForm,fieldName){var input=olaForm.find("select[name='"+fieldName+"']");if(input.length>0&&input.attr("value")===''){return false;}
return true;}
function isVehicleSelected(olaForm){var vehicleFound=olaForm.find(".vehicleFound");if(vehicleFound.hasClass("hideFindYour")){return false;}
if(!isCategorySelected(olaForm)){return false;}
if(!ct1.ola.vehicleDetails.isVRMInputted(olaForm)){return false;}
return true;}
function setFade(olaForm){var formSelectors=olaForm.find('select:not(.mmvFindYour select)');if(isVehicleSelected(olaForm)){olaForm.find(".olaFadeOn").removeClass("olaFadeOn").addClass("olaFadeOff");formSelectors.css('visibility','');}else{olaForm.find(".olaFadeOff").removeClass("olaFadeOff").addClass("olaFadeOn");}}
function setLocationHiddenFields(userLocation){var olaForm=jQuery("#olaVehicleDetails");olaForm.find('.vehicleFinder').attr("value",userLocation.getName());olaForm.find('.longitude').attr("value",userLocation.getLongitude());olaForm.find('.latitude').attr("value",userLocation.getLatitude());olaForm.find('.countryCode').attr("value",userLocation.getCountryCode());olaForm.find('.countyName').attr("value",userLocation.getCounty());changeMagazineUpgrade(olaForm);enableDisableCounty(olaForm);changeClassCode(olaForm);}
function setMMVFade(olaForm){var mmvSelectors=olaForm.find('.mmvFindYour select:not(.categorySelect, .subcategorySelect)');if(isCategorySelected(olaForm)){olaForm.find(".olaMMVFadeOn").removeClass("olaMMVFadeOn").addClass("olaMMVFadeOff");mmvSelectors.css('visibility','');}else{olaForm.find(".olaMMVFadeOff").removeClass("olaMMVFadeOff").addClass("olaMMVFadeOn");mmvSelectors.css('visibility','hidden');}}
function toggleEmail(olaForm){var includeEmailInAd=olaForm.find('.includeEmailInAd');var emailInAd=olaForm.find('.emailInAd');var email=olaForm.find('.email');var isChecked=jQuery(includeEmailInAd).attr('checked');if(isChecked){emailInAd.val(email.val());}else{emailInAd.val('');}}
ct1.ola.vehicleDetails.isVRMInputted=function(olaForm){if(olaForm.find(".olaVrm").length>0&&!ct1.ola.vehicleDetails.isInputted(olaForm,"ola.stockItem.regFull")){return false;}
return true;}
ct1.ola.vehicleDetails.isInputted=function(olaForm,fieldName){var input=olaForm.find("input[name='"+fieldName+"']");if(input.length>0&&input.attr("value")===''){return false;}
return true;}
jQuery('#olaVehicleDetails .categorySelect').live('enable-vehicle-details',function(e){e.preventDefault();enableInput(this);enableMMVInput(this);});jQuery('#olaVehicleDetails .subcategorySelect').live('enable-vehicle-details',function(e){e.preventDefault();enableInput(this);enableMMVInput(this);});jQuery('#olaVehicleDetails .vrmInput').live('enable-vehicle-details',function(e){e.preventDefault();enableInput(this);});jQuery('#olaVehicleDetails .mmvConfirm').live('enable-vehicle-details',function(e){e.preventDefault();enableInput(this);});jQuery('#olaVehicleDetails input[name=ola.sellerType]').click(function(){var olaForm=jQuery(this).closest("form");enableDealerName(olaForm);});jQuery('#olaVehicleDetails input[name=ola.stockItem.isMotOnDelivery]').click(function(){var olaForm=jQuery(this).closest("form");enableMotOnDelivery(olaForm);});jQuery('#olaVehicleDetails .descTxt').counter(1500);jQuery('#olaVehicleDetails .descTxt').live('focus',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");clearDescription(olaForm);});jQuery('#olaVehicleDetails').submit(function(){var olaForm=jQuery(this);clearDescription(olaForm);toggleEmail(olaForm);checkLocality(olaForm);});jQuery('#olaVehicleDetails input,select').live("keypress",function(e){if(e.keyCode===13){return false;}});jQuery('#olaVehicleDetails .includeEmailInAd').live("click",function(e){var olaForm=jQuery(this).closest("form");toggleEmail(olaForm);});jQuery('#olaVehicleDetails .vehicleFinder').focus(function(e){e.preventDefault();jQuery(this).click();});if(jQuery(".fakedpositioning").length){var mmvHeight=jQuery(".mmvFindYour").height();jQuery(".fakedpositioning").css("height",mmvHeight+"px")
var fakePos=jQuery(".fakedpositioning").offset();jQuery(".mmvFindYour").css({position:"absolute",top:fakePos.top,left:fakePos.left});};initEnableInput();initLocation();initEmail();};namespace("ct1.ola");ct1.ola.vrm=function(){function vehicleNotFound(olaForm,vehicleSummary){olaForm.find(".vehicleFound").addClass("hideFindYour");olaForm.find(".olaFadeOff").removeClass("olaFadeOff").addClass("olaFadeOn");olaForm.find("select:not(.mmvFindYour select)").css("visibility","hidden");resetMMV(olaForm);olaForm.find(".noVehicleNotFound").removeClass("noVehicleNotFound").addClass("vehicleNotFound");olaForm.find(".vehicleNotFound").removeClass("hideFindYour");}
function resetMMV(olaForm){setInputValue(olaForm,"ola.stockItem.make","");var channel=olaForm.find("input[name='ola.channel']").val();if(channel==='motorhome'){setInputValue(olaForm,"ola.stockItem.model","e.g. Voyager");setInputValue(olaForm,"ola.stockItem.derivative","e.g. 635EK");}else if(channel==='caravan'){var categorySelect=olaForm.find(".categorySelect");if(categorySelect===null||categorySelect.length<1){return;}
var category=categorySelect.attr("value");if(category=='Touring Caravan'){setInputValue(olaForm,"ola.stockItem.model","e.g. Odyssey");setInputValue(olaForm,"ola.stockItem.derivative","e.g. 656");}else{setInputValue(olaForm,"ola.stockItem.model","e.g. Leven");setInputValue(olaForm,"ola.stockItem.derivative","e.g. mk111");}}else{setInputValue(olaForm,"ola.stockItem.model","");setInputValue(olaForm,"ola.stockItem.derivative","");}
resetSelectValue(olaForm,"ola.stockItem.regYear");}
function vehicleFound(olaForm,vehicleSummary){resetMMV(olaForm);setVehicleValues(olaForm,vehicleSummary);olaForm.find(".vehicleFound").removeClass("hideFindYour");olaForm.find(".vehicleNotFound").removeClass("vehicleNotFound").addClass("noVehicleNotFound");olaForm.find(".noVehicleNotFound").addClass("hideFindYour");olaForm.find(".olaFadeOn").removeClass("olaFadeOn").addClass("olaFadeOff");olaForm.find("select:not(.mmvFindYour select)").css("visibility","");}
function setVehicleValues(olaForm,vehicleSummary){var dataStart=vehicleSummary.indexOf("{\"id\":");var data=vehicleSummary.substring(dataStart);data=data.substring(0,data.indexOf("};")+1);var vs=jQuery.parseJSON(data);setRegYear(vs);setTransmission(vs);setMMD(olaForm,vs);setSelectValue(olaForm,"ola.stockItem.regYear",vs.regYear);setSelectValue(olaForm,"ola.stockItem.colour",vs.colour);setSelectValue(olaForm,"ola.stockItem.bodyType",vs.doorPlanLiteral);setSelectValue(olaForm,"ola.stockItem.transmissionType",vs.transmission);setSelectValue(olaForm,"ola.stockItem.fuelType",vs.fuel);setInputValue(olaForm,"ola.stockItem.engineCapacity.value",vs.engineCapacity);setInputValue(olaForm,"ola.stockItem.grossVehicleWeight.value",vs.grossWeight);setInputValue(olaForm,"ola.stockItem.previousOwners",vs.numberOfOwners);setSelectToDefault(olaForm,"ola.stockItem.engineCapacity.unitSymbol");setSelectToDefault(olaForm,"ola.stockItem.grossVehicleWeight.unitSymbol");}
function resetVehicleValues(olaForm){var dropdowns=olaForm.find('.aboutVehicle select');dropdowns.attr('selectedIndex',0);var textFields=olaForm.find('.aboutVehicle input[type="text"]');textFields.attr('value',"");defaultRadio(olaForm,"ola.stockItem.driverLeftOrRight",jQuery('.driverLeftOrRight').text());}
function defaultRadio(olaForm,radioSetName,defaultValue){var radioSet=olaForm.find("input[name="+radioSetName+"]");for(var i=0;i<radioSet.length;i++){var radioValue=jQuery(radioSet[i]).attr("value");if(radioValue===defaultValue){jQuery(radioSet[i]).attr("checked",true);break;}}}
function getMMD(vs){var mmd=vs.make;if(vs.model!==undefined&&vs.model.length>0){mmd+=' '+vs.model;}
if(vs.derivative!==undefined&&vs.model.length>0){mmd+=' '+vs.derivative;}
mmd+=' '+vs.regYear;return mmd;}
function setMMD(olaForm,vs){var channel=olaForm.find("input[name='ola.channel']").val();if(channel==='motorhome'){setInputValue(olaForm,"ola.stockItem.chassisMake",vs.make);setInputValue(olaForm,"ola.stockItem.chassisModel",vs.model);}else{olaForm.find(".vsMakeModel").text(getMMD(vs));setInputValue(olaForm,"ola.stockItem.make",vs.make);setInputValue(olaForm,"ola.stockItem.model",vs.model);setInputValue(olaForm,"ola.stockItem.derivative",vs.derivative);}}
function setRegYear(vs){var regYear='';if(vs.firstRegistrationDate!==null&&vs.firstRegistrationDate.length>4){var regDate=new Date(vs.firstRegistrationDate);if(isNaN(regDate)){regYear=vs.firstRegistrationDate.substring(0,4);}else{regYear+=regDate.getFullYear();}}
vs['regYear']=regYear;}
function setTransmission(vs){var transmission='';var transCode=vs.transmissionCode;if(transCode=='A'){transmission='Automatic';}else if(transCode=='M'){transmission='Manual';}else if(transCode=='S'){transmission='Semi-Automatic';}
vs['transmission']=transmission;}
function setSelectToDefault(olaForm,name){var option=olaForm.find("select[name='"+name+"'] option:first");option.attr("selected","selected");}
function setInputTitleCaseValue(olaForm,name,value){if(value===''){return;}
var titleCase=convertToTitleCase(value);setInputValue(olaForm,name,titleCase);}
function setInputValue(olaForm,name,value){var input=olaForm.find("input[name='"+name+"']");jQuery(input).attr("value",value);}
function setSelectValue(olaForm,name,value){if(value===''){setSelectToDefault(olaForm,name);return;}
var select=olaForm.find("select[name='"+name+"']");var options=select.children();for(var i=0;i<options.length;i++){var optionText=jQuery(options[i]).text();if(value.toLowerCase()===optionText.toLowerCase()){var optionValue=jQuery(options[i]).attr("value");jQuery(select).attr("value",optionValue);break;}}}
function resetSelectValue(olaForm,name){var select=olaForm.find("select[name='"+name+"']");jQuery(select).attr("value","");}
function convertToTitleCase(value){var newValue='';var words=value.split(" ");for(var i=0;i<words.length;i++){var titleCase=value.substring(0,1)+value.substring(1,value.length).toLowerCase();newValue+=titleCase;if(i<words.length-1){newValue+=" ";}}
return newValue;}
function initDisplay(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var olaAlreadyPersisted=olaForm.find("input[name='ola.alreadyPersisted']");if(olaAlreadyPersisted.attr("value")==='true'){olaForm.find(".vehicleFound").removeClass("hideFindYour");}else{initVRMLookUp(olaForm);}}
function initVRMLookUp(olaForm){var vrmFind=olaForm.find(".vrmFind");var vehicleFound=olaForm.find(".vehicleFound");var vrmInput=olaForm.find(".vrmInput");if(vrmFind.length>0&&vrmInput.val()!==''&&vehicleFound.hasClass("hideFindYour")){vrmFind.click();}}
function cleanVRM(vrmInput){var vrm=vrmInput.val();var cleanVrm='';for(var i=0;i<vrm.length;i++){if((vrm.charCodeAt(i)>=48&&vrm.charCodeAt(i)<=57)||(vrm.charCodeAt(i)>=65&&vrm.charCodeAt(i)<=90)||(vrm.charCodeAt(i)>=97&&vrm.charCodeAt(i)<=122)){cleanVrm+=vrm.charAt(i);}}
if(vrm!==cleanVrm){vrmInput.val(cleanVrm);}}
$('.mmvChangeDetails').live('click',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");vehicleNotFound(olaForm);});$('.vrmFind').live('click',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");resetVehicleValues(olaForm);var vrm=olaForm.find(".vrmInput").val();if(vrm!==''){olaForm.find('.olaVrm').removeClass('vrmError');jQuery.get("vrm/vrm-lookup?vrm="+vrm,function(res){var isVehicleFound=res.length>6;var channel=olaForm.find("input[name='ola.channel']").val();if(isVehicleFound&&channel==='motorhome'){vehicleNotFound(olaForm);setVehicleValues(olaForm,res);}else if(isVehicleFound){vehicleFound(olaForm,res);}else{vehicleNotFound(olaForm);}
if(channel==='motorhome'){$("#modelInput").removeAttr("style");$("#derivativeInput").removeAttr("style");$("#modelInput").css({color:'#ccc'});$("#derivativeInput").css({color:'#ccc'});}});}else{olaForm.find('.olaVrm').addClass('vrmError');olaForm.find('.vrmInput').focus();}});$('.vrmInput').live('keyup',function(e){e.preventDefault();var olaForm=jQuery(this).closest("form");var vrmInput=jQuery(this);cleanVRM(vrmInput);if(vrmInput.val()===''){olaForm.find('.olaVrm').addClass('vrmError');}else{olaForm.find('.olaVrm').removeClass('vrmError');}
olaForm.find('.vrmInput').trigger('enable-vehicle-details');});$('.vrmInput,.vrmSellInput').live('blur',function(e){var vrmInput=jQuery(this);cleanVRM(vrmInput);});$('.vrmSellInput').live('keyup',function(e){e.preventDefault();var vrmInput=jQuery(this);cleanVRM(vrmInput);});jQuery('#olaInit input[name=ola.channel]').live("click",function(e){var olaForm=jQuery(this).closest("form");var sellerType=olaForm.find("input[name=ola.channel]:checked").attr("value");var channel=olaForm.find('.channel');channel.val(sellerType);});function toggleCommercialVehicle(olaForm,commercialVehicleInput){var channel=olaForm.find('.channel');var olaChannel=olaForm.find('.olaChannel');var isChecked=jQuery(commercialVehicleInput).attr('checked');if(isChecked){channel.val(commercialVehicleInput.val());olaChannel.val(commercialVehicleInput.val());}else{jQuery(commercialVehicleInput).attr("checked",false);}}
initDisplay();};namespace("ct1.ola");ct1.ola.watermark=function(){function initWaterMarkValues(){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var channel=olaForm.find("input[name='ola.channel']").val();if(channel==='motorhome'){var inputModelFieldSelector=olaForm.find("input[name='ola.stockItem.model']");var inputDerivativeFieldSelector=olaForm.find("input[name='ola.stockItem.derivative']");if(''===inputModelFieldSelector.val()){inputModelFieldSelector.val('e.g. Voyager');inputDerivativeFieldSelector.val('e.g. 635EK');inputModelFieldSelector.css({color:'#ccc'});inputDerivativeFieldSelector.css({color:'#ccc'});}}}
$('.categorySelect').change(function(e){e.preventDefault();var olaForm=jQuery(jQuery(this).closest("form"));var channel=olaForm.find("input[name='ola.channel']").val();if(channel==='caravan'){var selectedCategory=jQuery(this).attr("value");if(selectedCategory==='Touring Caravan'){if(isVehicleSelected(olaForm)){$("#modelInput").val("e.g. Odyssey");}
if(isVehicleSelected(olaForm)){$("#derivativeInput").val("e.g. 656");}}
if(selectedCategory==='Static Caravan'){if(isVehicleSelected(olaForm)){$("#modelInput").val("e.g. Leven");}
if(isVehicleSelected(olaForm)){$("#derivativeInput").val("e.g. mk111");}}}});function checkModelNullValues(olaForm){if(''===$("#modelInput").val()){return false;}
return true;};function checkDerivativeNullValues(olaForm){if(''===$("#derivativeInput").val()){return false;}
return true;};$('.modelInput,.derivativeInput').live('focus',function(e){var olaForm=jQuery("#olaVehicleDetails");if(olaForm===null||olaForm.length<1){return;}
var channel=olaForm.find("input[name='ola.channel']").val();if(channel==='motorhome'||channel==='caravan'){var mmvDropDown=jQuery(this).closest("div");var mmvInput=jQuery(mmvDropDown).find("input[type='text']");mmvInput.css({color:'#000'});}});function isVehicleSelected(olaForm){var vehicleFound=olaForm.find(".vehicleFound");if(!vehicleFound.hasClass("hideFindYour")){return false;}
return true;}
initWaterMarkValues();};(function($){$.fn.filestyle=function(options){var settings={width:250};if(options){$.extend(settings,options);};return this.each(function(){jQuery("#o_mu_manualUpload").hide();var self=this;var wrapper=$("<div id='manualUploadButton'>").css({"width":settings.imagewidth+"px","height":settings.imageheight+"px","background":"url("+settings.image+") 0 0 no-repeat","background-position":"right","display":"inline","position":"relative","float":"left","cursor":"hand","cursor":"pointer","margin":"5px 10px 0 0","left":"5px"});var filename=$('<input type="text" id="o_mu_basicUpload" class="file" readonly="true" />').addClass($(self).attr("class")).css({"position":"relative","float":"left","border":"2px solid #cccccc","top":"2px","height":"25px","z-index":"9","display":"inline","width":settings.width+"px"});var newWrapperDiv=$("<div>").css({"position":"relative","float":"left","z-index":"9","top":"4px","background-color":"#ffffff","padding-right":"10px","width":settings.width+"px","height":settings.imageheight+"px"});$(self).before(filename);$(filename).wrap(newWrapperDiv);$(self).wrap(wrapper);$(self).css({"position":"absolute","height":settings.imageheight+"px","width":settings.width+"px","display":"inline","cursor":"pointer","left":"10px","font-size":"145%","opacity":"0.0","margin-left":"-83px"});$(self).bind("change",function(){filename.val($(self).val());jQuery("#o_mu_manualUpload").show();});});};})(jQuery);var swfobject=function(){var UNDEF="undefined",OBJECT="object",SHOCKWAVE_FLASH="Shockwave Flash",SHOCKWAVE_FLASH_AX="ShockwaveFlash.ShockwaveFlash",FLASH_MIME_TYPE="application/x-shockwave-flash",EXPRESS_INSTALL_ID="SWFObjectExprInst",ON_READY_STATE_CHANGE="onreadystatechange",win=window,doc=document,nav=navigator,plugin=false,domLoadFnArr=[main],regObjArr=[],objIdArr=[],listenersArr=[],storedAltContent,storedAltContentId,storedCallbackFn,storedCallbackObj,isDomLoaded=false,isExpressInstallActive=false,dynamicStylesheet,dynamicStylesheetMedia,autoHideShow=true,ua=function(){var w3cdom=typeof doc.getElementById!=UNDEF&&typeof doc.getElementsByTagName!=UNDEF&&typeof doc.createElement!=UNDEF,u=nav.userAgent.toLowerCase(),p=nav.platform.toLowerCase(),windows=p?/win/.test(p):/win/.test(u),mac=p?/mac/.test(p):/mac/.test(u),webkit=/webkit/.test(u)?parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,ie=!+"\v1",playerVersion=[0,0,0],d=null;if(typeof nav.plugins!=UNDEF&&typeof nav.plugins[SHOCKWAVE_FLASH]==OBJECT){d=nav.plugins[SHOCKWAVE_FLASH].description;if(d&&!(typeof nav.mimeTypes!=UNDEF&&nav.mimeTypes[FLASH_MIME_TYPE]&&!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)){plugin=true;ie=false;d=d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");playerVersion[0]=parseInt(d.replace(/^(.*)\..*$/,"$1"),10);playerVersion[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/,"$1"),10);playerVersion[2]=/[a-zA-Z]/.test(d)?parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}
else if(typeof win.ActiveXObject!=UNDEF){try{var a=new ActiveXObject(SHOCKWAVE_FLASH_AX);if(a){d=a.GetVariable("$version");if(d){ie=true;d=d.split(" ")[1].split(",");playerVersion=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}}
catch(e){}}
return{w3:w3cdom,pv:playerVersion,wk:webkit,ie:ie,win:windows,mac:mac};}(),onDomLoad=function(){if(!ua.w3){return;}
if((typeof doc.readyState!=UNDEF&&doc.readyState=="complete")||(typeof doc.readyState==UNDEF&&(doc.getElementsByTagName("body")[0]||doc.body))){callDomLoadFunctions();}
if(!isDomLoaded){if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("DOMContentLoaded",callDomLoadFunctions,false);}
if(ua.ie&&ua.win){doc.attachEvent(ON_READY_STATE_CHANGE,function(){if(doc.readyState=="complete"){doc.detachEvent(ON_READY_STATE_CHANGE,arguments.callee);callDomLoadFunctions();}});if(win==top){(function(){if(isDomLoaded){return;}
try{doc.documentElement.doScroll("left");}
catch(e){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}}
if(ua.wk){(function(){if(isDomLoaded){return;}
if(!/loaded|complete/.test(doc.readyState)){setTimeout(arguments.callee,0);return;}
callDomLoadFunctions();})();}
addLoadEvent(callDomLoadFunctions);}}();function callDomLoadFunctions(){if(isDomLoaded){return;}
try{var t=doc.getElementsByTagName("body")[0].appendChild(createElement("span"));t.parentNode.removeChild(t);}
catch(e){return;}
isDomLoaded=true;var dl=domLoadFnArr.length;for(var i=0;i<dl;i++){domLoadFnArr[i]();}}
function addDomLoadEvent(fn){if(isDomLoaded){fn();}
else{domLoadFnArr[domLoadFnArr.length]=fn;}}
function addLoadEvent(fn){if(typeof win.addEventListener!=UNDEF){win.addEventListener("load",fn,false);}
else if(typeof doc.addEventListener!=UNDEF){doc.addEventListener("load",fn,false);}
else if(typeof win.attachEvent!=UNDEF){addListener(win,"onload",fn);}
else if(typeof win.onload=="function"){var fnOld=win.onload;win.onload=function(){fnOld();fn();};}
else{win.onload=fn;}}
function main(){if(plugin){testPlayerVersion();}
else{matchVersions();}}
function testPlayerVersion(){var b=doc.getElementsByTagName("body")[0];var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);var t=b.appendChild(o);if(t){var counter=0;(function(){if(typeof t.GetVariable!=UNDEF){var d=t.GetVariable("$version");if(d){d=d.split(" ")[1].split(",");ua.pv=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)];}}
else if(counter<10){counter++;setTimeout(arguments.callee,10);return;}
b.removeChild(o);t=null;matchVersions();})();}
else{matchVersions();}}
function matchVersions(){var rl=regObjArr.length;if(rl>0){for(var i=0;i<rl;i++){var id=regObjArr[i].id;var cb=regObjArr[i].callbackFn;var cbObj={success:false,id:id};if(ua.pv[0]>0){var obj=getElementById(id);if(obj){if(hasPlayerVersion(regObjArr[i].swfVersion)&&!(ua.wk&&ua.wk<312)){setVisibility(id,true);if(cb){cbObj.success=true;cbObj.ref=getObjectById(id);cb(cbObj);}}
else if(regObjArr[i].expressInstall&&canExpressInstall()){var att={};att.data=regObjArr[i].expressInstall;att.width=obj.getAttribute("width")||"0";att.height=obj.getAttribute("height")||"0";if(obj.getAttribute("class")){att.styleclass=obj.getAttribute("class");}
if(obj.getAttribute("align")){att.align=obj.getAttribute("align");}
var par={};var p=obj.getElementsByTagName("param");var pl=p.length;for(var j=0;j<pl;j++){if(p[j].getAttribute("name").toLowerCase()!="movie"){par[p[j].getAttribute("name")]=p[j].getAttribute("value");}}
showExpressInstall(att,par,id,cb);}
else{displayAltContent(obj);if(cb){cb(cbObj);}}}}
else{setVisibility(id,true);if(cb){var o=getObjectById(id);if(o&&typeof o.SetVariable!=UNDEF){cbObj.success=true;cbObj.ref=o;}
cb(cbObj);}}}}}
function getObjectById(objectIdStr){var r=null;var o=getElementById(objectIdStr);if(o&&o.nodeName=="OBJECT"){if(typeof o.SetVariable!=UNDEF){r=o;}
else{var n=o.getElementsByTagName(OBJECT)[0];if(n){r=n;}}}
return r;}
function canExpressInstall(){return!isExpressInstallActive&&hasPlayerVersion("6.0.65")&&(ua.win||ua.mac)&&!(ua.wk&&ua.wk<312);}
function showExpressInstall(att,par,replaceElemIdStr,callbackFn){isExpressInstallActive=true;storedCallbackFn=callbackFn||null;storedCallbackObj={success:false,id:replaceElemIdStr};var obj=getElementById(replaceElemIdStr);if(obj){if(obj.nodeName=="OBJECT"){storedAltContent=abstractAltContent(obj);storedAltContentId=null;}
else{storedAltContent=obj;storedAltContentId=replaceElemIdStr;}
att.id=EXPRESS_INSTALL_ID;if(typeof att.width==UNDEF||(!/%$/.test(att.width)&&parseInt(att.width,10)<310)){att.width="310";}
if(typeof att.height==UNDEF||(!/%$/.test(att.height)&&parseInt(att.height,10)<137)){att.height="137";}
doc.title=doc.title.slice(0,47)+" - Flash Player Installation";var pt=ua.ie&&ua.win?"ActiveX":"PlugIn",fv="MMredirectURL="+win.location.toString().replace(/&/g,"%26")+"&MMplayerType="+pt+"&MMdoctitle="+doc.title;if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+fv;}
else{par.flashvars=fv;}
if(ua.ie&&ua.win&&obj.readyState!=4){var newObj=createElement("div");replaceElemIdStr+="SWFObjectNew";newObj.setAttribute("id",replaceElemIdStr);obj.parentNode.insertBefore(newObj,obj);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
createSWF(att,par,replaceElemIdStr);}}
function displayAltContent(obj){if(ua.ie&&ua.win&&obj.readyState!=4){var el=createElement("div");obj.parentNode.insertBefore(el,obj);el.parentNode.replaceChild(abstractAltContent(obj),el);obj.style.display="none";(function(){if(obj.readyState==4){obj.parentNode.removeChild(obj);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.replaceChild(abstractAltContent(obj),obj);}}
function abstractAltContent(obj){var ac=createElement("div");if(ua.win&&ua.ie){ac.innerHTML=obj.innerHTML;}
else{var nestedObj=obj.getElementsByTagName(OBJECT)[0];if(nestedObj){var c=nestedObj.childNodes;if(c){var cl=c.length;for(var i=0;i<cl;i++){if(!(c[i].nodeType==1&&c[i].nodeName=="PARAM")&&!(c[i].nodeType==8)){ac.appendChild(c[i].cloneNode(true));}}}}}
return ac;}
function createSWF(attObj,parObj,id){var r,el=getElementById(id);if(ua.wk&&ua.wk<312){return r;}
if(el){if(typeof attObj.id==UNDEF){attObj.id=id;}
if(ua.ie&&ua.win){var att="";for(var i in attObj){if(attObj[i]!=Object.prototype[i]){if(i.toLowerCase()=="data"){parObj.movie=attObj[i];}
else if(i.toLowerCase()=="styleclass"){att+=' class="'+attObj[i]+'"';}
else if(i.toLowerCase()!="classid"){att+=' '+i+'="'+attObj[i]+'"';}}}
var par="";for(var j in parObj){if(parObj[j]!=Object.prototype[j]){par+='<param name="'+j+'" value="'+parObj[j]+'" />';}}
el.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+att+'>'+par+'</object>';objIdArr[objIdArr.length]=attObj.id;r=getElementById(attObj.id);}
else{var o=createElement(OBJECT);o.setAttribute("type",FLASH_MIME_TYPE);for(var m in attObj){if(attObj[m]!=Object.prototype[m]){if(m.toLowerCase()=="styleclass"){o.setAttribute("class",attObj[m]);}
else if(m.toLowerCase()!="classid"){o.setAttribute(m,attObj[m]);}}}
for(var n in parObj){if(parObj[n]!=Object.prototype[n]&&n.toLowerCase()!="movie"){createObjParam(o,n,parObj[n]);}}
el.parentNode.replaceChild(o,el);r=o;}}
return r;}
function createObjParam(el,pName,pValue){var p=createElement("param");p.setAttribute("name",pName);p.setAttribute("value",pValue);el.appendChild(p);}
function removeSWF(id){var obj=getElementById(id);if(obj&&obj.nodeName=="OBJECT"){if(ua.ie&&ua.win){obj.style.display="none";(function(){if(obj.readyState==4){removeObjectInIE(id);}
else{setTimeout(arguments.callee,10);}})();}
else{obj.parentNode.removeChild(obj);}}}
function removeObjectInIE(id){var obj=getElementById(id);if(obj){for(var i in obj){if(typeof obj[i]=="function"){obj[i]=null;}}
obj.parentNode.removeChild(obj);}}
function getElementById(id){var el=null;try{el=doc.getElementById(id);}
catch(e){}
return el;}
function createElement(el){return doc.createElement(el);}
function addListener(target,eventType,fn){target.attachEvent(eventType,fn);listenersArr[listenersArr.length]=[target,eventType,fn];}
function hasPlayerVersion(rv){var pv=ua.pv,v=rv.split(".");v[0]=parseInt(v[0],10);v[1]=parseInt(v[1],10)||0;v[2]=parseInt(v[2],10)||0;return(pv[0]>v[0]||(pv[0]==v[0]&&pv[1]>v[1])||(pv[0]==v[0]&&pv[1]==v[1]&&pv[2]>=v[2]))?true:false;}
function createCSS(sel,decl,media,newStyle){if(ua.ie&&ua.mac){return;}
var h=doc.getElementsByTagName("head")[0];if(!h){return;}
var m=(media&&typeof media=="string")?media:"screen";if(newStyle){dynamicStylesheet=null;dynamicStylesheetMedia=null;}
if(!dynamicStylesheet||dynamicStylesheetMedia!=m){var s=createElement("style");s.setAttribute("type","text/css");s.setAttribute("media",m);dynamicStylesheet=h.appendChild(s);if(ua.ie&&ua.win&&typeof doc.styleSheets!=UNDEF&&doc.styleSheets.length>0){dynamicStylesheet=doc.styleSheets[doc.styleSheets.length-1];}
dynamicStylesheetMedia=m;}
if(ua.ie&&ua.win){if(dynamicStylesheet&&typeof dynamicStylesheet.addRule==OBJECT){dynamicStylesheet.addRule(sel,decl);}}
else{if(dynamicStylesheet&&typeof doc.createTextNode!=UNDEF){dynamicStylesheet.appendChild(doc.createTextNode(sel+" {"+decl+"}"));}}}
function setVisibility(id,isVisible){if(!autoHideShow){return;}
var v=isVisible?"visible":"hidden";if(isDomLoaded&&getElementById(id)){getElementById(id).style.visibility=v;}
else{createCSS("#"+id,"visibility:"+v);}}
function urlEncodeIfNecessary(s){var regex=/[\\\"<>\.;]/;var hasBadChars=regex.exec(s)!=null;return hasBadChars&&typeof encodeURIComponent!=UNDEF?encodeURIComponent(s):s;}
var cleanup=function(){if(ua.ie&&ua.win){window.attachEvent("onunload",function(){var ll=listenersArr.length;for(var i=0;i<ll;i++){listenersArr[i][0].detachEvent(listenersArr[i][1],listenersArr[i][2]);}
var il=objIdArr.length;for(var j=0;j<il;j++){removeSWF(objIdArr[j]);}
for(var k in ua){ua[k]=null;}
ua=null;for(var l in swfobject){swfobject[l]=null;}
swfobject=null;});}}();return{registerObject:function(objectIdStr,swfVersionStr,xiSwfUrlStr,callbackFn){if(ua.w3&&objectIdStr&&swfVersionStr){var regObj={};regObj.id=objectIdStr;regObj.swfVersion=swfVersionStr;regObj.expressInstall=xiSwfUrlStr;regObj.callbackFn=callbackFn;regObjArr[regObjArr.length]=regObj;setVisibility(objectIdStr,false);}
else if(callbackFn){callbackFn({success:false,id:objectIdStr});}},getObjectById:function(objectIdStr){if(ua.w3){return getObjectById(objectIdStr);}},embedSWF:function(swfUrlStr,replaceElemIdStr,widthStr,heightStr,swfVersionStr,xiSwfUrlStr,flashvarsObj,parObj,attObj,callbackFn){var callbackObj={success:false,id:replaceElemIdStr};if(ua.w3&&!(ua.wk&&ua.wk<312)&&swfUrlStr&&replaceElemIdStr&&widthStr&&heightStr&&swfVersionStr){setVisibility(replaceElemIdStr,false);addDomLoadEvent(function(){widthStr+="";heightStr+="";var att={};if(attObj&&typeof attObj===OBJECT){for(var i in attObj){att[i]=attObj[i];}}
att.data=swfUrlStr;att.width=widthStr;att.height=heightStr;var par={};if(parObj&&typeof parObj===OBJECT){for(var j in parObj){par[j]=parObj[j];}}
if(flashvarsObj&&typeof flashvarsObj===OBJECT){for(var k in flashvarsObj){if(typeof par.flashvars!=UNDEF){par.flashvars+="&"+k+"="+flashvarsObj[k];}
else{par.flashvars=k+"="+flashvarsObj[k];}}}
if(hasPlayerVersion(swfVersionStr)){var obj=createSWF(att,par,replaceElemIdStr);if(att.id==replaceElemIdStr){setVisibility(replaceElemIdStr,true);}
callbackObj.success=true;callbackObj.ref=obj;}
else if(xiSwfUrlStr&&canExpressInstall()){att.data=xiSwfUrlStr;showExpressInstall(att,par,replaceElemIdStr,callbackFn);return;}
else{setVisibility(replaceElemIdStr,true);}
if(callbackFn){callbackFn(callbackObj);}});}
else if(callbackFn){callbackFn(callbackObj);}},switchOffAutoHideShow:function(){autoHideShow=false;},ua:ua,getFlashPlayerVersion:function(){return{major:ua.pv[0],minor:ua.pv[1],release:ua.pv[2]};},hasFlashPlayerVersion:hasPlayerVersion,createSWF:function(attObj,parObj,replaceElemIdStr){if(ua.w3){return createSWF(attObj,parObj,replaceElemIdStr);}
else{return undefined;}},showExpressInstall:function(att,par,replaceElemIdStr,callbackFn){if(ua.w3&&canExpressInstall()){showExpressInstall(att,par,replaceElemIdStr,callbackFn);}},removeSWF:function(objElemIdStr){if(ua.w3){removeSWF(objElemIdStr);}},createCSS:function(selStr,declStr,mediaStr,newStyleBoolean){if(ua.w3){createCSS(selStr,declStr,mediaStr,newStyleBoolean);}},addDomLoadEvent:addDomLoadEvent,addLoadEvent:addLoadEvent,getQueryParamValue:function(param){var q=doc.location.search||doc.location.hash;if(q){if(/\?/.test(q)){q=q.split("?")[1];}
if(param==null){return urlEncodeIfNecessary(q);}
var pairs=q.split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=")+1)));}}}
return"";},expressInstallCallback:function(){if(isExpressInstallActive){var obj=getElementById(EXPRESS_INSTALL_ID);if(obj&&storedAltContent){obj.parentNode.replaceChild(storedAltContent,obj);if(storedAltContentId){setVisibility(storedAltContentId,true);if(ua.ie&&ua.win){storedAltContent.style.display="block";}}
if(storedCallbackFn){storedCallbackFn(storedCallbackObj);}}
isExpressInstallActive=false;}}};}();namespace("ct1.product.insuranceHelpForm");ct1.product.insuranceHelpForm.initHelpLink=function(settings){activateHelpButton();function activateHelpButton(){jQuery(".insuranceHelp").live("click",function(){ct1.product.insuranceHelpForm.openHelpForm(this.href);return false;});}};ct1.product.insuranceHelpForm.openHelpForm=function(url){var processingMessage=jQuery(".partExchangeWidgetProcessingMessageContent").html();var lightboxSettings={height:350,width:770,closeOnVeilClick:false};function showProcessingMessage(){jQuery(".lbContent").html(processingMessage);}
function initCloseLightboxButton(){var closeButton=jQuery(".lbContent a[name=closeLightbox]");if(closeButton.length>0){closeButton.click(function(){ct1.lightboxTools.close();return false;});}}
function initTryAgainButton(){var tryAgainButton=jQuery(".lbContent a[name=tryAgain]");if(tryAgainButton.length>0){tryAgainButton.click(function(){ct1.lightboxTools.close();return false;});}}
function initDetailsForm(){initCommentsButtons();var detailsForm=jQuery("form[name=insuranceHelpForm]");if(detailsForm.length>0){detailsForm.submit(function(){var commentsBox=jQuery("textarea[name='comments']");var comments=commentsBox.val();var noCommentInput=jQuery("input[name='noComment']");var $commentsYesNo="<div name='commentsYesNo'>Do you wish to post this query with no comments?<span name='sendNoComment'>Yes</span> <span name='stopSend'>No</span></div>";if((comments==undefined||comments==''||comments==null)&&noCommentInput.val()=='false'){commentsBox.replaceWith($commentsYesNo);noCommentInput.val('true');initCommentsButtons();return false;}
var $form=jQuery(this);var postUrl=$form.attr("action");var postData=$form.serialize();showProcessingMessage();jQuery.ajax({url:postUrl,dataType:"html",type:"POST",cache:false,data:postData,contentType:"application/x-www-form-urlencoded; charset=UTF-8",complete:function(response){jQuery(".lbContent").html(response.responseText);initDetailsForm();initTryAgainButton();initCloseLightboxButton();}});return false;});}}
function initCommentsButtons(){var yesSpan=jQuery("span[name='sendNoComment']");var noSpan=jQuery("span[name='stopSend']");var detailsForm=jQuery("form[name=insuranceHelpForm]");var commentsWarningSpan=jQuery("div[name='commentsYesNo']");var noCommentInput=jQuery("input[name='noComment']");if(yesSpan.length>0){yesSpan.click(function(){detailsForm.submit();});}
if(noSpan.length>0){noSpan.click(function(){noCommentInput.val('false');commentsWarningSpan.replaceWith("<textarea name='comments' rows='5' cols='75'/>");});}}
function openFormInLightbox(){ct1.lightboxTools.loadContentForUrl(url,{height:350,width:770,closeOnVeilClick:false,onBoxCreated:function(box){showProcessingMessage();},replace:true},function(){initDetailsForm();});}
openFormInLightbox();};namespace("ct1.product.loans");ct1.product.loans.initLoansLink=function(settings){function createCrossDomainRequest(url){var request;if(isUseXDomainRequest()){request=new window.XDomainRequest();}else{request=new XMLHttpRequest();}
return request;}
function handleFormErrors(message){var errorMessage=message.substring("Error: ".length);var invalidFields=(errorMessage).split("Invalid: ");var invalidField;var $input;for(var i=0;i<invalidFields.length;i++){if(invalidFields[i]!=""){invalidField=invalidFields[i].substring(0,invalidFields[i].indexOf(";"));$input=jQuery("#"+invalidField);$input.addClass("error");jQuery("#error").show();}}}
function handleMinimumCriteriaFailed(){jQuery("#formResponse").removeClass();jQuery("#formResponse").show();jQuery("#formResponse").addClass("err-resp").text("The minimum criteria for this application was not met.");}
function handleSuccessfulApplication(){jQuery("#formResponse").removeClass();jQuery("#formResponse").show();jQuery("#formResponse").addClass("success").text("Thank you for your application! A consultant will contact you as soon as possible. ");jQuery("#vehicle-form").hide();}
function handleUnexpectedError(){jQuery("#formResponse").removeClass();jQuery("#formResponse").show();jQuery("#formResponse").addClass("err-resp").text("There was an unexpected error. Please try again.");}
function isIe6(){return jQuery.browser.msie&&parseInt(jQuery.browser.version)<7;}
function isUseXDomainRequest(){return typeof window.XDomainRequest!="undefined";}
function parseResponseMessage(responseText){var indexMessageNode=responseText.indexOf("<string");var indexMessageStart=responseText.indexOf(">",indexMessageNode)+1;var indexMessageEnd=responseText.indexOf("</string>",indexMessageStart);var message=responseText.substring(indexMessageStart,indexMessageEnd);return message;}
function validateEmailAddress(){var valid=true;var $emailInput=jQuery("#Email");var emailAddress=jQuery("#Email").val();if(emailAddress==""||!/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(emailAddress)){$emailInput.addClass("error");valid=false;}
return valid;}
function validateFormFields(){var valid=validateEmailAddress();valid=validateIdNumber()&&valid;valid=validateNames()&&valid;valid=validateTelephoneNumbers()&&valid;if(valid){jQuery("#error").hide();}else{jQuery("#error").show();}
return valid;}
function validateIdNumber(){var valid=true;var $idInput=jQuery("#IDNumber");if($idInput.val().length!=13){$idInput.addClass("error");valid=false;}
return valid;}
function validateNames(){var valid=true;var $firstNameInput=jQuery("#FirstName");if($firstNameInput.val().length<2){$firstNameInput.addClass("error");valid=false;}
var $surnameInput=jQuery("#Surname");if($surnameInput.val().length<2){$surnameInput.addClass("error");valid=false;}
return valid;}
function validateTelephoneNumbers(){var valid=true;var $homeNumberInput=jQuery("#HomeNumber");if($homeNumberInput.val().length!=10){$homeNumberInput.addClass("error");valid=false;}
var $alternativeNumberInput=jQuery("#AlternativeNumber");if($alternativeNumberInput.val().length!=10){$alternativeNumberInput.addClass("error");valid=false;}
return valid;}
if(!isIe6()){var request=createCrossDomainRequest();jQuery("#vehicle-button").click(function(){jQuery("#formResponse").hide();if(validateFormFields()){var url=settings.loansServerUrl+"?"+
jQuery("form").serialize();if(isUseXDomainRequest()){request.onload=outputResult;request.open("GET",url,true);request.send();}else{request.open("GET",url,true);request.onreadystatechange=handler;request.setRequestHeader("Content-type","application/x-www-form-urlencoded");request.send();}}else{return false;}});jQuery(":input").focus(function(){jQuery(this).removeClass("error");});}
function handler(evtXHR){if(request.readyState==4){if(request.status==200){outputResult();}else{handleUnexpectedError();}}}
function outputResult(){var message=parseResponseMessage(request.responseText);if(message=="Successful"){handleSuccessfulApplication();}else if(message=="MinimumCriteriaFailed"){handleMinimumCriteriaFailed();}else if(message.indexOf("Error:")==0){handleFormErrors(message);}else{handleUnexpectedError();}}};eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('l C(1l){g 1m=1X.1Y.1Z.1n(1);g 19=1m.1o("&");D(g i=0;i<19.p;i++){g 1a=19[i].1o("=");4(1a[0]==1l){o 1a[1]}}}l 20(){g i;D(i=0;i<3.f[\'e\'].w.h.p;i++){4(3.f[\'e\'].w.h[i].8==C(\'w\')){3.f[\'e\'].w.t=i}}D(i=0;i<3.f[\'e\'].d.h.p;i++){4(3.f[\'e\'].d.h[i].8==C(\'d\')){3.f[\'e\'].d.t=i}}D(i=0;i<3.f[\'e\'].J.h.p;i++){4(3.f[\'e\'].J.h[i].8==C(\'J\')){3.f[\'e\'].J.t=i}}4(C(\'y\')>0){3.f[\'e\'].y.8=C(\'y\')}4(C(\'1b\')>0){3.f[\'e\'].1b.8=C(\'1b\')}}l 1c(x){3.5(\'d\').h.p=0;3.5(\'d\').h[0]=E K(\'r 1p...\',\'-1\');D(i=1;i<=x;i++){4(i==1){3.5(\'d\').h[i]=E K(i+\' 1q \',i*12)}s{3.5(\'d\').h[i]=E K(i+\' U\',i*12)}}}l 1d(x){3.5(\'d\').h.p=0;3.5(\'d\').h[0]=E K(\'1p...\',\'-1\');D(i=1;i<=x;i++){4(i==1){3.5(\'d\').h[i]=E K(i+\' 1q \',i*12)}s{3.5(\'d\').h[i]=E K(i+\' U\',i*12)}}}l 21(1r){3.5(\'1e\').F.B=1r?"":"R"}l 1f(V){g 22=V.8;g 1g=V.p;4(1g==0){o L}D(g i=0;i!=1g;i++){S=V.1n(i,i+1);S=S.23();4((S<"0"||S>"9")){o L}}o G}l 1s(){g 7=\'\';4(3.5(\'w\').8==2){4(3.f[\'e\'].d.8>1t){7+=" - W M N O 1u a P q 10 U."}4(3.f[\'e\'].d.h.p>11){g v=3.f[\'e\'].d.t;1d(10);4(v<11){3.f[\'e\'].d.t=v}}4(3.5(\'y\').8>X){7+=" - W M N O a P q � X."}}s{4(3.f[\'e\'].d.h.p<1v){g v=3.f[\'e\'].d.t;1d(10);3.f[\'e\'].d.t=v}4(3.5(\'y\').8>Y){7+=" - 1w M N O a P q &1x; Y."}}o 7}l 1y(){g 7=\'\';4(3.5(\'w\').8==2){4(3.f[\'e\'].d.8>1t){7+="<c j=\'k\'>W M N O 1u a P q 10 U.</c>"}4(3.f[\'e\'].d.h.p>11){g v=3.f[\'e\'].d.t;1c(10);4(v<11){3.f[\'e\'].d.t=v}}4(3.5(\'y\').8>X){7+="<c j=\'k\'>W M N O a P q � X.</c>"}}s{4(3.f[\'e\'].d.h.p<1v){g v=3.f[\'e\'].d.t;1c(10);3.f[\'e\'].d.t=v}4(3.5(\'y\').8>Y){7+="<c j=\'k\'>1w M N O a P q &1x; Y.</c>"}}o 7}l 1z(13){g 14=E 1A("^[a-24-Z]{1,2}[0-9][0-25-1B-z]{0,1}$");g m=14.1C(13);4(m==15||m.p<1){o L}s{o G}}l 1D(13){g 14=E 1A("^[0-9][A-1B-z]{2}$");g m=14.1C(13);4(m==15||m.p<1){o L}s{o G}}l 26(){g 7="";g 16="<b>r 1E u 1F 1G:</b><27/><1H>";g 1I="</1H></28>";4(!(1f(3.5(\'y\').8))){7+="<c j=\'k\'>Q 1J 1h a 29 8.</c>"}4(3.5(\'d\').8==-1){7+="<c j=\'k\'>r H u Q 1K.</c>"}4(3.5(\'J\').8==-1){7+="<c j=\'k\'>r H u 1L q u Q.</c>"}4(3.5(\'w\').8==-1){7+="<c j=\'k\'>r H I 1M 1N.</c>"}s{7+=1y()}4(3.5(\'1i\').F.B==""&&3.5(\'2a\').8==-1){7+="<c j=\'k\'>r H I 2b 2c 2d.</c>"}4(3.5(\'17\')!=15){4(3.5(\'17\').18){4(3.5(\'2e\').8==-1){7+="<c j=\'k\'>T u 1j q 1k 2f 2g 2h 1O 2i.</c>"}4(3.5(\'2j\').8==-1){7+="<c j=\'k\'>T u 1j q 1k 2k 2l D 1P u 2m 6 2n.</c>"}4(3.5(\'2o\').8==-1){7+="<c j=\'k\'>T u 1j q 1k 2p 2q 2r 2s 2t.</c>"}4(3.5(\'2u\').8==-1){7+="<c j=\'k\'>T 2v 2w 1O 2x 2y 1P I 2z 2A.</c>"}4(3.5(\'1Q\').8==-1){7+="<c j=\'k\'>T I 1Q.</c>"}4(!(1z(3.5(\'2B\').8))){7+="<c j=\'k\'>1R 2C 1S q I 1T 1h 1U.</c>"}4(!(1D(3.5(\'2D\').8))){7+="<c j=\'k\'>1R 2E 1S q I 1T 1h 1U.</c>"}}}4(7!=""){3.5(\'1V\').2F=16+7+1I;3.5(\'1V\').B="2G";o L}s{o G}}l 2H(){4(3.5(\'w\').8==2&&(3.5(\'2I\').18==G||3.5(\'2J\').18==G)){3.5(\'1i\').F.B="R"}s{3.5(\'1i\').F.B="R"}}l 2K(){4(3.5(\'17\')!=15){4(3.5(\'17\').18==G){3.5(\'1W\').F.B="R";3.5(\'1e\').F.B=""}s{3.5(\'1W\').F.B="";3.5(\'1e\').F.B="R"}}}l 2L(){g 7="";g 16="r 1E u 1F 1G:\\n\\n";4(!(1f(3.5(\'y\').8))){7+=" - r 2M a Q 1J.\\n"}4(3.5(\'d\').8==-1){7+=" - r H a Q 1K.\\n"}4(3.5(\'J\').8==-1){7+=" - r H u 1L q u Q.\\n"}4(3.5(\'w\').8==-1){7+=" - r H I 1M 1N.\\n"}s{7+=1s()}4(3.5(\'2N\').8==-1){7+=" - r H I 2O 2P.\\n"}4(7!=""){2Q(16+7);o L}s{3.5(\'e\').2R();o G}}',62,178,'|||document|if|getElementById||errorMsg|value||||li|repaymentPeriod|theForm|forms|var|options||class|errortext|function|||return|length|of|Please|else|selectedIndex|the|intIndex|residentialStatus||loanAmount|||display|getQueryVariable|for|new|style|true|select|your|loanPurpose|Option|false|can|only|borrow|maximum|Loan|none|aChar|Specify|years|textObj|Tenants|25000|250000|||||strOutCode|re|null|header|creditSearch|checked|vars|pair|channelID|PopulateDropdownLoanRepayPeriod|PopulateDropdownLoanRepayPeriodForMiniConsole|divCreditExpertQuestions|chkValidNumber|newLength|is|trTotalCurrentDebt|number|credit|variable|query|substring|split|Select|year|bool|ResetTenantHomeownerValuesForMiniConsole|120|over|40|Homeowners|pound|ResetTenantHomeownerValues|chkOutCode|RegExp|Za|exec|chkInCode|check|following|items|ul|footer|Amount|Period|Purpose|Residential|Status|you|in|age|The|part|postcode|invalid|lblErrors|creditprofilequestion|window|location|search|PopulatePageFromQueryString|DisplayRiskQuestions|newValue|toUpperCase|zA|9A|Validate|br|font|mandatory|totalCurrentDebt|Total|Current|Debt|noCards|or|store|cards|own|noProductsApplied|products|applied|last|months|noAccountsWithBalance|accounts|with|an|outstanding|balance|lengthCurrentHome|how|long|have|lived|current|home|txtOutCode|first|txtInCode|second|innerHTML|block|ShowHideTotalCurrentDebt|poor|fair|DisplayCreditProfileQuestion|ValidateMiniConsole|enter|creditProfile|Credit|Profile|alert|submit'.split('|'),0,{}))
ct1.activateYourAccount=function(){function initLinks(isOlaSubmit){if(isOlaSubmit){jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");jQuery('.lightboxForgotPasswordOla').trigger('forgot-password-lightbox-loaded');jQuery('.lightboxSignInOla').trigger('sign-in-lightbox-loaded');jQuery('.lightboxActivateYourAccountOla').trigger('activate-your-account-lightbox-loaded');}else{jQuery('.lightboxActivateYourAccount').trigger('activate-your-account-lightbox-loaded');jQuery('.lightboxSignIn').trigger('sign-in-lightbox-loaded');}}
function submitActivateYourAccount(isOlaSubmit){jQuery('#activateYourAccountForm').bind('submit',function(e){e.preventDefault();var activateYourAccountForm=jQuery(jQuery(this).closest("form"));var registerUri=activateYourAccountForm.attr('action');jQuery.post(registerUri,activateYourAccountForm.serialize(),function(res){activateYourAccountForm.parent().replaceWith(res);initLinks(isOlaSubmit);});});}
jQuery('.lightboxActivateYourAccountOla').live('activate-your-account-lightbox-loaded',function(e){e.preventDefault();jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");submitActivateYourAccount(true);});jQuery('.lightboxActivateYourAccount').live('activate-your-account-lightbox-loaded',function(e){e.preventDefault();submitActivateYourAccount(false);});};ct1.forgotPassword=function(){function initLinks(isOlaSubmit){if(isOlaSubmit){jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");jQuery('.lightboxForgotPasswordOla').trigger('forgot-password-lightbox-loaded');jQuery('.lightboxSignInOla').trigger('sign-in-lightbox-loaded');}else{jQuery('.lightboxForgotPassword').trigger('forgot-password-lightbox-loaded');jQuery('.lightboxSignIn').trigger('sign-in-lightbox-loaded');}}
function submitForgotPassword(isOlaSubmit){jQuery('#forgotPasswordForm').bind('submit',function(e){e.preventDefault();var forgotPasswordForm=jQuery(jQuery(this).closest("form"));var registerUri=forgotPasswordForm.attr('action');jQuery.post(registerUri,forgotPasswordForm.serialize(),function(res){forgotPasswordForm.parent().replaceWith(res);initLinks(isOlaSubmit);});});}
jQuery('.lightboxForgotPasswordOla').live('forgot-password-lightbox-loaded',function(e){e.preventDefault();jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");submitForgotPassword(true);});jQuery('.lightboxForgotPassword').live('forgot-password-lightbox-loaded',function(e){e.preventDefault();submitForgotPassword(false);});};ct1.register=function(signIn){function initLinks(isOlaSubmit){if(isOlaSubmit){jQuery(".lightboxSignIn").removeClass("lightboxSignIn").addClass("lightboxSignInOla");jQuery('.lightboxRegisterOla').trigger('register-lightbox-loaded');}else{jQuery('.lightboxRegister').trigger('register-lightbox-loaded');}}
function submitRegister(isOlaSubmit){signIn.populateEmailFieldIn("registerForm");jQuery('#registerForm').bind('submit',function(e){e.preventDefault();var registerForm=jQuery(jQuery(this).closest("form"));var registerUri=registerForm.attr('action');jQuery.post(registerUri,registerForm.serialize(),function(res){if(!/regErrorMessage/.test(res)){var formString=registerForm.serialize();var startIndex=formString.indexOf("=",formString.indexOf("firstName"))+1;var endIndex=formString.indexOf("&",startIndex);var userName=formString.substring(startIndex,endIndex);var serverUrl=registerUri.replace("add-za-user","");var accountNavHtml="<div class=\"iconSprite loginReg\">"+"Hi, "+userName+": "+"<a title=\"My Account\" href=\""+serverUrl+"my-account\">My Account</a>"+" | "+"<a class=\"signOut\" href=\""+serverUrl+"sign-out-user\">Sign Out</a>"+"</div>";jQuery(".loginReg").replaceWith(accountNavHtml);signIn.updateAuthenticationStatus();if(jQuery('#lightbox').length>0){jQuery.lightbox.close();if(isOlaSubmit){signIn.submitOla();}}
ct1.omnitureUtils.addEvent("event3");ct1.all_pages.trackPage();}else{registerForm.parent().replaceWith(res);initLinks(isOlaSubmit);signIn.checkPasswordError("registerForm");}});});}
function updateUserEmail(){var updateUserForm=jQuery('#updateUserDetails').closest("form");if(updateUserForm===null||updateUserForm.length<1){return;}
var mailAddress=updateUserForm.find(".mailaddress");if(mailAddress.html()===''){var emailAddressValue=updateUserForm.find("input[name='userProfile.email']").attr("value");mailAddress.html(emailAddressValue);}}
jQuery('.lightboxRegisterOla').live('register-lightbox-loaded',function(e){e.preventDefault();submitRegister(true);jQuery(".lightboxSignIn").removeClass("lightboxSignIn").addClass("lightboxSignInOla");});jQuery('.lightboxRegister').live('register-lightbox-loaded',function(e){e.preventDefault();submitRegister(false);});updateUserEmail();};ct1.signIn=function(){function updateStatus(userCookie){var authStatus=jQuery("div.rLinks");if(userCookie.isSignedIn()){authStatus.find("span.firstName").html(userCookie.getFirstName());}}
function updateOlaStatus(userCookie){if(jQuery("ul.olasignin").length>0){var authStatus=jQuery("ul.olasignin");if(userCookie.isSignedIn()){authStatus.removeClass("signedOut").addClass("signedIn");var olaForm=jQuery(authStatus).closest("form");updateTextField(olaForm,"email",userCookie.getEmail());}else{authStatus.removeClass("signedIn").addClass("signedOut");}}}
function clickOla(userCookie){if(jQuery("ul.olasignin").length>0){var authStatus=jQuery("ul.olasignin");if(userCookie.isSignedIn()){jQuery(authStatus).find(".olaContinue").click();}}}
function updateTextField(olaForm,fieldClass,fieldValue){var field=olaForm.find("."+fieldClass);if(field.length>0&&field.attr('value')===''){field.attr('value',fieldValue);}}
function initLinks(isOlaSubmit){if(isOlaSubmit){jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");jQuery(".lightboxForgotPassword").removeClass("lightboxForgotPassword").addClass("lightboxForgotPasswordOla");jQuery(".lightboxActivateYourAccount").removeClass("lightboxActivateYourAccount").addClass("lightboxActivateYourAccountOla");jQuery('.lightboxSignInOla').trigger('sign-in-lightbox-loaded');}else{jQuery('.lightboxSignIn').trigger('sign-in-lightbox-loaded');}}
function submitSignIn(isOlaSubmit){that.populateEmailFieldIn("signinForm");jQuery('#signinForm').bind('submit',function(e){e.preventDefault();var signInForm=jQuery(this).closest("form");var signInUri=signInForm.attr('action');jQuery.post(signInUri,signInForm.serialize(),function(res){if(!/regErrorMessage/.test(res)){var serverUrl=signInUri.replace("sign-in-user","");var accountNavHtml="<div class=\"iconSprite loginReg\">"+"Hi, <span class=\"firstName\"></span>: "+"<a title=\"My Account\" href=\""+serverUrl+"my-account\">My Account</a>"+" | "+"<a class=\"signOut\" href=\""+serverUrl+"sign-out-user\">Sign Out</a>"+"</div>";jQuery(".loginReg").replaceWith(accountNavHtml);var userCookie=new ct1.UserCookie(jQuery.cookie('ctuser'));updateStatus(userCookie);jQuery('body').data('lastSignInEmail',signInForm.find('input.email').val());if(jQuery('#lightbox').length>0){jQuery.lightbox.close();that.updateAuthenticationStatus();if(isOlaSubmit){that.submitOla();}}
jQuery('.signInTrigger').trigger('signed-in');ct1.omnitureTrackingHandler("events=event49|linksPos=rhs|linkName=sign_in_button");}else{signInForm.parent().replaceWith(res);initLinks(isOlaSubmit);}});});}
function performSingleSignIn(userIdValue,isEncryptedValue){var signInUri=jQuery(".lightboxSignIn").attr("href");if(signInUri===''){return;}
var singleSignInUri=signInUri+'-user-id';jQuery.get(singleSignInUri,{userId:userIdValue,isEncrypted:isEncryptedValue},function(res){var userCookie=new ct1.UserCookie(jQuery.cookie('ctuser'));updateStatus(userCookie);updateOlaStatus(userCookie);});}
function submitSignInToDetails(){that.populateEmailFieldIn("signinForm");var $signInForm=jQuery('#signInToDetailsForm').unbind('submit');var $signInFormFields=$signInForm.find('input, select').unbind('keypress');$signInFormFields.bind('keypress',function(e){if(e.keyCode===13){postSignInToDetailsForm($signInForm);return false;}});$signInForm.bind('submit',function(e){e.preventDefault();postSignInToDetailsForm($signInForm);});}
function postSignInToDetailsForm(signInForm){var signInUri=signInForm.attr('action');jQuery.post(signInUri,signInForm.serialize(),function(res){if(!/regErrorMessage/.test(res)){if(jQuery('#lightbox').length>0){jQuery.lightbox.close();}
jQuery(".content").replaceWith(res);}else{signInForm.parent().replaceWith(res);signInForm.trigger('sign-in-to-details-lightbox-loaded');}});}
var sensitivePaths=new Array("/my-account","/my-details","/update-user","/ola/","/sell-your-","/manage-my-adverts","/watchlist");function isSensitivePath(){var pathname=window.location.pathname;for(var i=0;i<sensitivePaths.length;i++){if(pathname.indexOf(sensitivePaths[i])>-1){return true;}}
return false;}
function executeAfterSignInFunctions(){var $executeAfterSignIn=jQuery(".executeAfterSignIn");$executeAfterSignIn.each(function(){var $this=jQuery(this);eval($this.val());if(!$this.hasClass("executeAfterEachSignIn")){$this.remove();}});$executeAfterSignIn.remove();}
function executeAfterSignOutFunctions(){var $executeAfterSignOut=jQuery(".executeAfterSignOut");$executeAfterSignOut.each(function(){var $this=jQuery(this);eval($this.val());if(!$this.hasClass("executeAfterEachSignOut")){$this.remove();}});$executeAfterSignOut.remove();}
jQuery('#updateUserDetails .submitUpdate').live('click',function(e){e.preventDefault();var updateUserForm=jQuery(this).closest("form");var updateUserUri=updateUserForm.attr('action');jQuery.post(updateUserUri,updateUserForm.serialize(),function(res){jQuery(".content").replaceWith(res);that.checkPasswordError("updateUserDetails");$(window).scrollTop(0);});});jQuery('a.signOutLink').live('click',function(e){e.preventDefault();if(isSensitivePath()){location.href=this.href;}else{jQuery.get(this.href,function(res){that.updateAuthenticationStatus();});}});jQuery('.lightboxSignInOla').live('sign-in-lightbox-loaded',function(e){e.preventDefault();submitSignIn(true);jQuery(".lightboxRegister").removeClass("lightboxRegister").addClass("lightboxRegisterOla");jQuery(".lightboxForgotPassword").removeClass("lightboxForgotPassword").addClass("lightboxForgotPasswordOla");});jQuery('.lightboxSignIn').live('sign-in-lightbox-loaded',function(e){e.preventDefault();submitSignIn(false);});jQuery('#signInToDetailsForm').live('sign-in-to-details-lightbox-loaded',function(e){e.preventDefault();submitSignInToDetails();});jQuery('#updateUserDetails input,select').live("keypress",function(e){if(e.keyCode===13){return false;}});var that={};that.checkPasswordError=function(formId){var passwordForm=jQuery('#'+formId).closest("form");var password=passwordForm.find("input[name='userProfile.password']");var rePassword=passwordForm.find("input[name='rePassword']");if(password.hasClass("error")){rePassword.addClass("error");}else{rePassword.removeClass("error");}};that.populateEmailFieldIn=function(formId){if(jQuery("ul.olasignin").length>0){var authStatus=jQuery("ul.olasignin");var olaForm=jQuery(authStatus).closest("form");updateTextField(jQuery('#'+formId),"email",olaForm.find(".email").attr("value"));}};that.updateAuthenticationStatus=function(){var userCookieValue=jQuery.cookie('ctuser');var atUserCookieValue=jQuery.cookie('user');var encryptedUserId=jQuery.cookie('ursid');if(userCookieValue===null&&encryptedUserId!==null){performSingleSignIn(encryptedUserId,true);}else if(userCookieValue===null&&atUserCookieValue!==null){}else{var userCookie=new ct1.UserCookie(userCookieValue);updateStatus(userCookie);updateOlaStatus(userCookie);if(userCookie.isSignedIn()){executeAfterSignInFunctions();}else{executeAfterSignOutFunctions();}}};that.submitOla=function(){var userCookie=new ct1.UserCookie(jQuery.cookie('ctuser'));clickOla(userCookie);};that.updateAuthenticationStatus();return that;};ct1.signIn.executeAfterSignIn=function(fn){var fnAsExecutableStr;if(typeof fn=="function"){fnAsExecutableStr="("+fn.toString()+")();";}else{fnAsExecutableStr=fn;}
var $executeAfterSignIn=jQuery("<textarea class='executeAfterSignIn' style='display:none;'></div>");jQuery("body").append($executeAfterSignIn);$executeAfterSignIn.val(fnAsExecutableStr);};ct1.signIn.executeAfterSignOut=function(fn){var fnAsExecutableStr;if(typeof fn=="function"){fnAsExecutableStr="("+fn.toString()+")();";}else{fnAsExecutableStr=fn;}
var $executeAfterSignOut=jQuery("<textarea class='executeAfterSignOut' style='display:none;'></textarea>");jQuery("body").append($executeAfterSignOut);$executeAfterSignOut.val(fnAsExecutableStr);};ct1.signIn.isUserSignedIn=function(){var userCookieValue=jQuery.cookie("ctuser");var userCookie=new ct1.UserCookie(userCookieValue);return userCookie.isSignedIn();};namespace("ct1.search.criteria");ct1.search.criteria.toSeoName=function(name){name=name.toLowerCase();var seoName="";var c;for(var i=0;i<name.length;i++){c=name.charAt(i);if((c>="a"&&c<="z")||(c>="0"&&c<="9")){seoName+=c;}else if(i>0&&seoName.charAt(seoName.length-1)!="-"){seoName+="-";}}
if(seoName.length>0){while(seoName.charAt(seoName.length-1)=="-"){seoName=seoName.substring(0,seoName.length-1);}}
return seoName;};ct1.search.criteria.SearchCriteria=function(){var criteria=[];function isContainsCriterion(criterion){for(var i=0;i<criteria.length;i++){if(criteria[i].equals(criterion)){return true;}}
return false;}
function isKeywordCriterion(criterion){return typeof criterion.getTerms=="function";}
this.addCriterion=function(criterion){if(!isContainsCriterion(criterion)){criteria[criteria.length]=criterion;}};this.removeCriterion=function(criterion){var newCriteria=[];for(var i=0;i<criteria.length;i++){if(!criteria[i].equals(criterion)){newCriteria[newCriteria.length]=criteria[i];}}
if(criteria.length!=newCriteria.length){criteria=newCriteria;}};this.removeAllCriteria=function(){criteria=[];};this.getCriteriaByDimensionName=function(dimensionName){var dimensionCriteria=[];for(var i=0;i<criteria.length;i++){if(typeof criteria[i].getDimensionName=="function"&&criteria[i].getDimensionName()==dimensionName){dimensionCriteria[dimensionCriteria.length]=criteria[i];}}
return dimensionCriteria;};this.getGeoSearchCriterion=function(){var criterion=null;for(var i=0;i<criteria.length&&criterion==null;i++){if(typeof criteria[i].getRadius=="function"){criterion=criteria[i];}}
return criterion;};this.getKeywordCriterion=function(){var criterion=null;for(var i=0;i<criteria.length&&criterion==null;i++){if(typeof criteria[i].getTerms=="function"){criterion=criteria[i];}}
return criterion;};this.toSearchUrl=function(options){var url=options.searchServerUrl;if(options.prefix){url+=options.prefix;}
var keywordCriterion=null;for(var i=0;i<criteria.length;i++){if(isKeywordCriterion(criteria[i])){keywordCriterion=criteria[i];}else{url+=criteria[i].toUrlPathParameter();}}
if(options.searchPath){url+=options.searchPath;}
var queryString="";if(keywordCriterion!=null){queryString="keywords="+keywordCriterion.getTerms();}
if(options.params){for(var name in options.params){if(options.params[name]!=null){if(queryString.length>0){queryString+="&";}
queryString+=name+"="+encodeURIComponent(options.params[name]);}}}
var location=ct1.location.UserLocationManager.getInstance().getUserLocation();if(location!=null){if(queryString.length>0){queryString+="&";}
queryString+=location.toQueryStringParameters();}
if(queryString.length>0){url+="?"+queryString;}
return url;};this.equals=function(searchCriteria){var equals=false;var otherCriteria=searchCriteria.getCriteria();if(criteria.length==otherCriteria.length){for(var i=0;i<otherCriteria.length;i++){if(!isContainsCriterion(otherCriteria[i])){return false;}}
equals=true;}
return equals;};this.getCriteria=function(){return criteria;};this.clone=function(){var clone=new ct1.search.criteria.SearchCriteria();for(var i=0;i<criteria.length;i++){clone.addCriterion(criteria[i].clone());}
return clone;};};ct1.search.criteria.SearchCriteria.fromJson=function(jsonCriteria){var searchCriteria=new ct1.search.criteria.SearchCriteria();var criterion;if(jsonCriteria!=null&&jsonCriteria!=undefined){for(var i=0;i<jsonCriteria.length;i++){if(jsonCriteria[i].terms){criterion=ct1.search.criteria.KeywordCriterion.fromJson(jsonCriteria[i]);}else if(jsonCriteria[i].parentValue){criterion=ct1.search.criteria.ParentChildDimensionCriterion.fromJson(jsonCriteria[i]);var j=i+1;while(j<jsonCriteria.length){if(jsonCriteria[j].parentValue!=null&&jsonCriteria[j].parentValue.name==criterion.getParentValue()){criterion.addChildValue(jsonCriteria[j].childValue.name);j++;}else{break;}}
i=j-1;}else if(jsonCriteria[i].dimension){criterion=ct1.search.criteria.SimpleDimensionCriterion.fromJson(jsonCriteria[i]);}else if(jsonCriteria[i].radius){criterion=ct1.search.criteria.GeoSearchCriterion.fromJson(jsonCriteria[i]);}else{throw new Error("Unrecognised criterion: "+jQuery.toJSON(jsonCriteria[i]));}
searchCriteria.addCriterion(criterion);}}
return searchCriteria;};ct1.search.criteria.CriterionInterface=function(){this.toUrlPathParameter=function(){};this.clone=function(){};this.equals=function(criterion){};};ct1.search.criteria.DimensionCriterionInterface=function(){this.getDimensionName=function(){};};ct1.search.criteria.SimpleDimensionCriterion=function(dimensionName,value){var dimensionName;var value;this.getDimensionName=function(){return dimensionName;};this.getValue=function(){return value;};this.toUrlPathParameter=function(){return"/"+ct1.search.criteria.toSeoName(dimensionName)+"/"+ct1.search.criteria.toSeoName(value);};this.clone=function(){return new ct1.search.criteria.SimpleDimensionCriterion(dimensionName,value);};this.equals=function(criterion){if(criterion!=null){return this.toUrlPathParameter()==criterion.toUrlPathParameter();}
return null;};};ct1.search.criteria.SimpleDimensionCriterion.fromJson=function(jsonCriterion){return new ct1.search.criteria.SimpleDimensionCriterion(jsonCriterion.dimension.name,jsonCriterion.value.name);};ct1.search.criteria.ParentChildDimensionCriterion=function(dimensionName,parentDimensionName,childDimensionName,parentValue,childValues){var childDimensionName;var childValues;var dimensionName;var parentDimensionName;var parentValue;this.addChildValue=function(value){childValues[childValues.length]=value;};this.clone=function(){var childValuesClone=[];for(var i=0;i<childValues.length;i++){childValuesClone[i]=childValues[i];}
return new ct1.search.criteria.ParentChildDimensionCriterion(dimensionName,parentDimensionName,childDimensionName,parentValue,childValuesClone);};this.equals=function(criterion){if(criterion!=null){return this.toUrlPathParameter()==criterion.toUrlPathParameter();}
return null;};this.getChildDimensionName=function(){return childDimensionName;};this.getChildValues=function(){return childValues;};this.getDimensionName=function(){return dimensionName;};this.getParentDimensionName=function(){return parentDimensionName;};this.getParentValue=function(){return parentValue;};this.removeChildValue=function(value){var newChildValues=[];for(var i=0;i<childValues.length;i++){if(childValues[i]!=value){newChildValues[newChildValues.length]=childValues[i];}}
childValues=newChildValues;};this.setChildValues=function(values){childValues=values;};this.toUrlPathParameter=function(){var urlPath="/"+ct1.search.criteria.toSeoName(dimensionName)+"/"+
ct1.search.criteria.toSeoName(parentDimensionName)+"/"+ct1.search.criteria.toSeoName(parentValue);for(var i=0;i<childValues.length;i++){urlPath+="/"+ct1.search.criteria.toSeoName(childDimensionName)+"/"+
ct1.search.criteria.toSeoName(childValues[i]);}
return urlPath;};};ct1.search.criteria.ParentChildDimensionCriterion.fromJson=function(jsonCriterion){var dimensionName=jsonCriterion.dimension.name;var parentDimensionName=jsonCriterion.dimension.parentDimension.name;var childDimensionName=jsonCriterion.dimension.childDimension.name;var parentValue=jsonCriterion.parentValue.name;var childValues=[];if(jsonCriterion.childValue!=null){childValues[0]=jsonCriterion.childValue.name;}
return new ct1.search.criteria.ParentChildDimensionCriterion(dimensionName,parentDimensionName,childDimensionName,parentValue,childValues);};ct1.search.criteria.KeywordCriterion=function(terms){var terms;this.getTerms=function(){return terms;}
this.toUrlPathParameter=function(){return"/keywords/"+encodeURIComponent(terms);};this.clone=function(){return new ct1.search.criteria.KeywordCriterion(terms);};this.equals=function(criterion){if(criterion!=null){return this.toUrlPathParameter()==criterion.toUrlPathParameter();}
return null;};};ct1.search.criteria.KeywordCriterion.fromJson=function(jsonCriterion){return new ct1.search.criteria.KeywordCriterion(jsonCriterion.terms);};ct1.search.criteria.GeoSearchCriterion=function(radius,radiusUnit){var radius;var radiusUnit;this.getRadius=function(){return radius;};this.getRadiusUnit=function(){return radiusUnit;};this.toUrlPathParameter=function(){return"/radius/"+radius+radiusUnit.toLowerCase();};this.clone=function(){return new ct1.search.criteria.GeoSearchCriterion(radius,radiusUnit);};this.equals=function(criterion){if(criterion!=null){return this.toUrlPathParameter()==criterion.toUrlPathParameter();}
return null;};};ct1.search.criteria.GeoSearchCriterion.fromJson=function(jsonCriterion){return new ct1.search.criteria.GeoSearchCriterion(jsonCriterion.radius.toString(),jsonCriterion.radiusUnit);};(function($){$.fn.googleAdsenseAdverts=function(options){var self=this;var settings=jQuery.extend({google_query_param:"gquery",google_ad_safe:"high",google_encoding:"utf8",google_language:"en",testMode:"off",channel:"Van",keywords:null,searchTerms:null,pageNumber:1,gquery:null,queryParamName:'gquery=',clientId:"autotrader-vanstrucks-uk",pageType:"search"},options);var carPrepends=['used','used cars','pre-owned','secondhand','cheap','buy used','','used cars','new cars'];var bikePrepends=['used','used bikes','pre-owned','secondhand','cheap','buy used','','used bikes','new bikes'];var commercialPrepends=['used','used vans','used trucks','pre-owned','secondhand','cheap','buy used','','used vans','used trucks','new vans','new trucks'];var plantPrepends=['used','used plant','pre-owned','secondhand','cheap','buy used','','used plant','new plant'];var farmPrepends=['used','used farm','pre-owned','secondhand','cheap','buy used','','used farm','new farm'];var leisurePrepends=['used','used caravan','used motorhome','used boat','pre-owned','secondhand','buy used','','used caravan','used motorhome','used boat','new caravan','new motorhome','new boat'];var channelPrepends=carPrepends;if(settings.channel=="Commercial"){channelPrepends=commercialPrepends;}
else if(settings.channel=="Plant"){channelPrepends=plantPrepends;}
else if(settings.channel=="Farm"){channelPrepends=farmPrepends;}
else if(settings.channel=="Bike"){channelPrepends=bikePrepends;}
else if(settings.channel=="Leisure"){channelPrepends=leisurePrepends;}
function requestAFSAds(){if(getGquery()==null){if(settings.keywords!=null&&settings.keywords!=''){google_afs_query=settings.keywords;}
else if(settings.searchTerms!=null&&settings.searchTerms!=''){google_afs_query=settings.searchTerms;}
else{google_afs_query=settings.channel;if(google_afs_query=="Plant")google_afs_query+=" machinery";}
google_afs_query=channelPrepends[Math.floor(Math.random()*channelPrepends.length)]+" "+google_afs_query;}
else{google_afs_query=getGquery();}
$(self).data('last_query',google_afs_query);google_afs_channel=settings.channel;google_afs_adtest=settings.testMode;google_afs_adpage=settings.pageNumber;google_afs_client=settings.clientId;google_afs_ad='w7n0';google_afs_adsafe=settings.google_ad_safe;google_afs_oe=settings.google_encoding;google_afs_hl=settings.google_language;google_afs_request_done=formatAds;document.write("<scr"+"ipt type='text/javascript' src='http://www.google.com/afsonline/show_afs_ads.js'>"+"</scr"+"ipt>");}
function requestAFCAds(){google_ad_channel=settings.channel;google_adtest=settings.testMode;google_ad_client=settings.clientId;google_max_num_ads='7';google_ad_type='text';google_ad_output='js';google_safe=settings.google_ad_safe;google_encoding=settings.google_encoding;google_language=settings.google_language;google_ad_request_done=formatAds;document.write("<scr"+"ipt type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>"+"</scr"+"ipt>");}
function getGquery(){if(settings.gquery!=null&&settings.gquery!='')return settings.gquery;return null;}
function storeGquery(query){$("div.paginator a, div.display a").each(function(){var href=$(this).attr('href');if(href!=null){href=href+=querySeparator(href)+settings.queryParamName+encodeURIComponent(query);$(this).attr('href',href);}});$("div.sort select option").each(function(){var val=$(this).attr('value');if(val!=null){val=val+='&'+settings.queryParamName+encodeURIComponent(query);$(this).attr('value',val);}});}
function querySeparator(href){if(href.indexOf("?")!==-1)
return"&";else
return"?";}
function formatAds(ads){ct1.addEarlyUXComponent(function(){var templateContainer=$(self);var jsTemplate=templateContainer.find("script[type=text/html]").jsTemplate();templateContainer.html(jsTemplate.toHtml({ads:ads}));storeGquery($(self).data('last_query'));});}
requestAFCAds();return this;};})(jQuery);(function($){jQuery.fn.quickSearch=function(settings){var priceDimensionName;var selectLists;var $vehicleCounter;var $errorMessage;var $loadingOverlay;var $this=this;function addMaxPriceCriteria(criteria){var $maxPriceSelectList=selectLists[priceDimensionName];var indexOfSelectedMaxPriceOption=$maxPriceSelectList[0].selectedIndex;if(indexOfSelectedMaxPriceOption>0&&!$maxPriceSelectList.hasClass("implicit")){$options=$maxPriceSelectList.find("option");for(var i=1;i<=indexOfSelectedMaxPriceOption;i++){criteria.addCriterion(new ct1.search.criteria.SimpleDimensionCriterion(priceDimensionName,$options[i].value));}}}
function getSearchCriteria(){var criteria=new ct1.search.criteria.SearchCriteria();var $selectList=null;for(var name in selectLists){if(name!="Model"){$selectList=selectLists[name];if($selectList[0].selectedIndex>0&&!$selectList[0].disabled){var value=$selectList.find("option:selected").val();if(name==priceDimensionName){addMaxPriceCriteria(criteria);}else if(name=="Make"){var $modelSelectList=selectLists["Model"];if($modelSelectList){var models=[];if($modelSelectList[0].selectedIndex>0){models[0]=$modelSelectList.find("option:selected").val();}
criteria.addCriterion(new ct1.search.criteria.ParentChildDimensionCriterion("MakeModel","Make","Model",value,models));}else{criteria.addCriterion(new ct1.search.criteria.SimpleDimensionCriterion("Make",value));}}else{criteria.addCriterion(new ct1.search.criteria.SimpleDimensionCriterion(name,value));}}}}
return criteria;}
function hideErrorMessage(){$errorMessage.addClass("hidden");}
function hideLoadingOverlay(){$loadingOverlay.addClass("hidden");}
function init(){initVehicleCounter();initSelectLists();initSubmit();initLoadingOverlayAndErrorMessage();}
function initLoadingOverlayAndErrorMessage(){$loadingOverlay=jQuery(".searchUpdating");$errorMessage=$loadingOverlay.find(".errorMessage");var $tryAgainAnchor=$errorMessage.find("a[name=tryAgain]");$tryAgainAnchor.click(function(){hideErrorMessage();refreshFormOptions();return false;});}
function initSelectLists(){selectLists={};var $selectLists=$this.find("select");var $selectList=null;var name=null;for(var i=0;i<$selectLists.length;i++){$selectList=jQuery($selectLists[i]);name=$selectList.attr("name");selectLists[name]=$selectList;$selectList.change(function(){var $selectList=selectLists[this.name];var $selectedOption=$selectList.find("option:selected");selectOption($selectList,$selectedOption);});if(name.containsIgnoreCase("price")){priceDimensionName=name;}
$selectLists[i].selectedIndex=0;}}
function initSubmit(){$this.submit(function(){var params={};$this.find("input:hidden").each(function(index){params[this.name]=this.value;});var url=getSearchCriteria().toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/search",params:params});if($this.attr("target")=="_blank"){window.open(url);}else{window.location=url;}
return false;});}
function initVehicleCounter(){$vehicleCounter=jQuery(".vehicleCounter").vehicleCounter(settings);}
function refreshFormOptions(){showLoadingOverlay();var searchCriteria=getSearchCriteria();var url=searchCriteria.toSearchUrl({prefix:$this.attr("action"),searchServerUrl:settings.searchServerUrl});jQuery.ajax({cache:false,dataType:"json",error:function(jqXHR,textStatus,errorThrown){showErrorMessage();},success:function(data,textStatus,jqXHR){if(data&&data.totalNumberOfResults){$vehicleCounter.setValue(data.totalNumberOfResults);var dimensions=data.dimensions;for(var name in dimensions){resetSelectListOptions(selectLists[name],dimensions[name]);}
hideLoadingOverlay();}else{showErrorMessage();}},type:"GET",url:url});}
function removeModelSelection(){var $modelSelectList=selectLists["Model"];if($modelSelectList&&$modelSelectList[0].selectedIndex>0){$modelSelectList.attr("disabled","disabled");$modelSelectList[0].selectedIndex=0;var $anchor=$modelSelectList.next("a.rmvSel");$anchor.addClass("hidden");$modelSelectList.removeClass("hidden");}}
function resetSelectListOptions($selectList,refinements){var $options=$selectList.find("option");var $option=null;var displayName=null;for(var i=0;i<refinements.length;i++){if($options[i+1]){$option=jQuery($options[i+1]);}else{$option=jQuery("<option value=''></option>");$selectList.append($option);}
$option.val(refinements[i].name);if(refinements[i].displayName){displayName=refinements[i].displayName;}else{displayName=refinements[i].name;}
$option.text(displayName+" ("+ct1.utilities.formatNumber(refinements[i].count)+")");}
for(var i=$options.length-1;i>refinements.length;i--){jQuery($options[i]).remove();}
if(refinements.length<=1){$selectList.attr("disabled","disabled");if(refinements.length==1){$selectList[0].selectedIndex=1;$selectList.addClass("implicit");}}else{$selectList[0].selectedIndex=0;$selectList.removeAttr("disabled");}}
function selectOption($selectList,$selectedOption){var $anchor=$selectList.next("a.rmvSel");$anchor.unbind("click");$anchor.click(function(){if($selectList.attr("name")=="Make"){removeModelSelection();}
$selectList[0].selectedIndex=0;refreshFormOptions();$anchor.addClass("hidden");$selectList.removeClass("hidden");return false;});$selectList.addClass("hidden");var label=$selectedOption.text();$anchor.find("span").text(label.substring(0,label.lastIndexOf(" (")));$anchor.removeClass("hidden");refreshFormOptions();}
function showErrorMessage(){$errorMessage.removeClass("hidden");}
function showLoadingOverlay(){$loadingOverlay.removeClass("hidden");}
init();return this;};})(jQuery);(function($){jQuery.fn.vehicleCounter=function(settings){var currentValue=null;var $this=this;function init(){$this.setValue(settings.totalNumberOfResults);}
function getCurrentValueAsZeroPaddedString(){var paddedValue=currentValue.toString();while(paddedValue.length<5){paddedValue="0"+paddedValue;}
return paddedValue;}
function updateAnimatedOdometer(){var value=currentValue/1000;var counterEnd=value.toString();var increment=value;$this.empty();$this.jOdometer({counterEnd:counterEnd,counterStart:"00.000",delayTime:10,increment:increment,numbersImage:settings.staticContentServerUrl+"/web/images/search/jodometer-numbers.png"});}
function updateUnanimatedOdometer(){var value=getCurrentValueAsZeroPaddedString();var insertedNumber;var commaToInsert;$this.html("");for(var i=0;i<value.length;i++){if(i==1){commaToInsert="<div style='color:#6c6c6c;float:left;font-weight:bold;font-size:27px;"+"padding-left:2px;padding-right:4px;height:30px;width:5px;'>,</div>";}else{commaToInsert='';}
insertedNumber="<div style='color:#6c6c6c;float:left;font-weight:bold;font-size:27px;"+"padding-left:5px;padding-right:2px;height:30px;width:18px;'>"+value.charAt(i)+"</div>";$this.append(insertedNumber+commaToInsert);}}
function useAnimation(){return!jQuery.fx.off&&!$(".vehicleCounter").hasClass("unanimated");}
this.getValue=function(){return currentValue;};this.setValue=function(value){if(currentValue==null||currentValue!=value){currentValue=value;if(useAnimation()){updateAnimatedOdometer();}else{updateUnanimatedOdometer();}}};init();return this;};})(jQuery);namespace("ct1.search.advert");ct1.search.advert.init=function(settings){ct1.search.watchlist.initWatchlistButtons({searchServerUrl:settings.searchServerUrl});if(settings.videoSlideShowLightBoxLink){settings.videoSlideShowLightBoxLink.data("settings",settings.videoSlideShowSettings);}
jQuery(".lightboxEmailSeller").removeClass("hidden");ct1.search.advert.photoScroller();ct1.search.advert.bindReportAdvertSubmit();};ct1.search.advert.print=function(){ct1.search.advert.performRedirectLoggedAction('.detailsPrintLink','advertPrintButton');window.print();};ct1.search.advert.getNewKaptchaImage=function(){var randomNumber=new Date().getTime()+""+Math.floor(Math.random()*1000);var emailForm=jQuery("#emailSellerForm");var captchaId=emailForm.find("input[name='captchaId']").attr("value");jQuery("#kaptchaImage").attr("src",serverUrl+'/captcha-image?captchaId='+encodeURIComponent(captchaId)+'&tmp='+randomNumber);emailForm.find("input[name='captchaId']").val(captchaId);}
ct1.search.advert.performRedirectLoggedAction=function(link,actionId){if(!actionId)actionId='unk';var redirectUrlCall=$(link).find('var[class=redirectUrlCall]').attr('title');if(redirectUrlCall!=null){var axel=Math.random()+"";var num=axel*1000000000000000000;redirectUrlCall=redirectUrlCall.replace('_timestamp_',num);var trackingImg=$('#'+actionId+'redirectLoggerTrackingImg');if(trackingImg.length>0)
trackingImg.remove();trackingImg=$('<img/>').attr('src',redirectUrlCall).attr('class','hidden').attr('id',actionId+'redirectLoggerTrackingImg');$('body').append(trackingImg);}};ct1.search.advert.bindEmailSubmit=function(){$(".emailSellerSendButton").click(function(e){e.preventDefault();ct1.search.advert.performRedirectLoggedAction(this,'advertEmailSellerSendButton');var emailForm=$(this).closest("#emailSellerForm");var phoneNo=emailForm.find("input[name=phone]").val().replace(/\s/g,"");emailForm.find("input[name=phone]").val(phoneNo);$(".lbContent .emailSellerModule .emailSellerSendButton").addClass('disabled');$(".lbContent .emailSellerModule .inProgressMessage").show();$(".lbContent .emailSellerModule .emailSellerSendButton").unbind('click');$.ajax({type:"POST",url:emailForm.attr('action'),data:"send&"+emailForm.serialize(),cache:false,timeout:60000,contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"html",complete:function(res,textStatus){if((textStatus=="timeout")||(textStatus=="parsererror")){$(".emailSellerModule .olaerror.networkError").show();}else{$(".lbContent").html(res.responseText);}
ct1.search.advert.bindEmailSubmit();}});});};ct1.search.advert.bindReportAdvertSubmit=function(){var bindForm=function(e){var form=jQuery("#reportAdvertForm");form.find('textarea[name=description]').counter(200);form.find("input:radio[name=reason]").die();form.find("input:radio[name=reason]").change(function(){var reason=$(this).val();if(reason=="Other")
form.find("div#reportAdOtherText").show();else
form.find("div#reportAdOtherText").hide();});form.find("input:radio[name=reason]:checked").change();form.find(".reportAdvertSubmitButton").die();var submitForm=function(eventName){var reason=form.find("input:radio[name=reason]:checked");if(!reason.hasClass('reportAdReasonNoDesc'))
form.find("textarea[name=description]").val('');jQuery.ajax({type:"POST",url:form.attr('action'),data:eventName+"&"+form.serialize(),cache:false,contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"html",complete:function(res){jQuery(".lbContent").html(res.responseText);bindForm();}});};form.find(".reportAdvertSubmitButton").click(function(e){e.preventDefault();submitForm("submit");});form.submit(function(e){e.preventDefault();submitForm("submit");return false;});form.find("#kaptchaImage, #kaptchaLabel").die();form.find("#kaptchaImage, #kaptchaLabel").click(function(e){e.preventDefault();submitForm("reset");});};jQuery('div.reportAdvertLightbox').live('lightbox-loaded',bindForm);};ct1.search.advert.bindKaptchaImage=function(){jQuery("#emailSellerForm #kaptchaImage").live("click",function(){jQuery(this).unbind();var emailForm=$(this).closest("#emailSellerForm");var phoneNo=emailForm.find("input[name=phone]").val().replace(/\s/g,"");emailForm.find("input[name=phone]").val(phoneNo);$.ajax({type:"POST",url:emailForm.attr('action')+"?reset=true",cache:false,data:emailForm.serialize(),dataType:"html",complete:function(res){$(".lbContent").html(res.responseText);ct1.search.advert.bindEmailSubmit();var content=$(".lbContent").html();content=content.substring(content.indexOf("=",content.indexOf("captchaId"))+1);var startIndex=content.indexOf("=",content.indexOf("captchaId"))+1;var endIndex=content.indexOf(" ",startIndex)-1;var captchaId=content.substring(startIndex,endIndex);$("input[name='captchaId']").val(captchaId);}});});jQuery("#emailSellerForm #kaptchaLabel").live("click",function(){jQuery(this).unbind();var emailForm=$(this).closest("#emailSellerForm");var phoneNo=emailForm.find("input[name=phone]").val().replace(/\s/g,"");emailForm.find("input[name=phone]").val(phoneNo);$.ajax({type:"POST",url:emailForm.attr('action')+"?reset=true",cache:false,data:emailForm.serialize(),dataType:"html",complete:function(res){$(".lbContent").html(res.responseText);ct1.search.advert.bindEmailSubmit();var content=$(".lbContent").html();content=content.substring(content.indexOf("=",content.indexOf("captchaId"))+1);var startIndex=content.indexOf("=",content.indexOf("captchaId"))+1;var endIndex=content.indexOf(" ",startIndex)-1;var captchaId=content.substring(startIndex,endIndex);$("input[name='captchaId']").val(captchaId);}});});}
ct1.search.advert.photoScroller=function(){var isAnimating=false;jQuery(".adPhotos").addClass("hidden");jQuery(document).ready(function(){jQuery(".adPhotos").removeClass("hidden");var $imgContWid;$imgContWid=parseInt(jQuery(".imgsContain").width()/2)-120;jQuery(".imgsContain").css("margin-left","-"+$imgContWid+"px");jQuery(".adPhoL").click(function(){if(!isAnimating){isAnimating=true;var bigPhot=jQuery(".bigPhoto");var appendPhot=jQuery(".photoTbl td").last();jQuery(".imgsContain").animate({"margin-left":"-"+parseInt($imgContWid-89)},400,function(){jQuery(".imgsContain").css("margin-left","-"+$imgContWid+"px");jQuery(".photoTbl").prepend(appendPhot);isAnimating=false;});jQuery(bigPhot).prev().find("img").css({border:"4px solid #CCC",width:"106"});jQuery(".bigPhoto img").css({border:"0",width:"80"});jQuery(bigPhot).prev().removeClass("normSiz").addClass("bigPhoto");jQuery(bigPhot).removeClass("bigPhoto").addClass("normSiz");jQuery(".normSiz img").removeAttr("style");jQuery(".bigPhoto img").removeAttr("style");$this=jQuery(".bigPhoto").clone().html();jQuery(".bigImg").html($this.replace('/160"','/400"'));}});jQuery(".adPhoR").click(function(){if(!isAnimating){isAnimating=true;var bigPhot=jQuery(".bigPhoto");var appendPhot=jQuery(".photoTbl td").first();jQuery(".imgsContain").animate({"margin-left":"-"+parseInt($imgContWid+89)},400,function(){jQuery(".imgsContain").css("margin-left","-"+$imgContWid+"px");jQuery(".photoTbl").append(appendPhot);isAnimating=false;});jQuery(bigPhot).next().find("img").css({border:"4px solid #CCC",width:"106"});jQuery(".bigPhoto img").css({border:"0",width:"80"});jQuery(bigPhot).next().removeClass("normSiz").addClass("bigPhoto");jQuery(bigPhot).removeClass("bigPhoto").addClass("normSiz");jQuery(".normSiz img").removeAttr("style");jQuery(".bigPhoto img").removeAttr("style");$this=jQuery(".bigPhoto").clone().html();jQuery(".bigImg").html($this.replace('/160"','/400"'));}});jQuery(".photoTbl a").click(function(){$this=jQuery(this).clone();$this.find("img").attr("src",$this.find("img").attr("src").replace('/160','/400'));jQuery(".bigImg").html($this);});});};namespace("ct1.search.advert.media");ct1.search.advert.media.photoGallery=function(galleryDiv,largerImages){var thumbFadeDuration=0;var thumbFadeTo=0.4;var thumbnailScrollDuration=1000;var isAdvantageGallery=$('.lightboxPhotoGalleryContent').hasClass('advantageGallery');var thumnailsVisible=isAdvantageGallery?4:(largerImages?10:9);var thumbnailWidth=isAdvantageGallery?(110+6+5+3):(60+6+5+3);var thumnailsCurrentLeft=0;var page=1;var scrollLock=false;var thumbnails=$('#lightbox .imageGalleryNavigation');var numImages=thumbnails.find('li').size();var numPages=Math.ceil(numImages/thumnailsVisible);if(numPages==0)numPages=1;var navigationScrollAmount=thumbnailWidth*thumnailsVisible;$('#lightbox .imageGalleryNavigation li a').click(function(e){e.preventDefault();var list=$(this).parent().parent();var idx=$(this).parent().index();var currentIndex=list.data('imageGalleryNavigationIndex');if(currentIndex==null)currentIndex=idx;var currentThumb=$(list).find('li:nth-child('+(currentIndex+1)+') a');var thumb=null;currentIndex=idx;thumb=$(this,'a');if(thumb!=null){currentThumb.find('img').fadeTo(thumbFadeDuration,thumbFadeTo);thumb.find('img').fadeTo(thumbFadeDuration,1);$('#lightbox .newMasterImage').attr('src',thumb.attr('href')).show();}
list.data('imageGalleryNavigationIndex',currentIndex);scrollCurrentThumbIntoView(currentIndex);jQuery('#lightbox .previousAndNextNavigation .counter').html('Image '+(currentIndex+1)+'/'+numImages);});$('#lightbox .previousAndNextNavigation div a').click(function(e){e.preventDefault();var self=$(this);var list=jQuery('#lightbox .imageGalleryNavigation');var idx=$(this).parent().index();var currentIndex=list.data('imageGalleryNavigationIndex');if(currentIndex==null)currentIndex=idx;var numImages=list.find('a').size();var thumb=null;if(self.hasClass('previousImage')){currentIndex=currentIndex-1;if(currentIndex<0)currentIndex=numImages-1;thumb=$(list).find('li:nth-child('+(currentIndex+1)+') a');}
else{currentIndex=currentIndex+1;if(currentIndex>numImages-1)currentIndex=0;thumb=$(list).find('li:nth-child('+(currentIndex+1)+') a');}
scrollCurrentThumbIntoView(currentIndex);thumb.click();});$('#lightbox .advantageGallery .changeImage a').click(function(e){e.preventDefault();var list=jQuery('#lightbox .imageGalleryNavigation');var idx=$(this).parent().index();var currentIndex=list.data('imageGalleryNavigationIndex');if(currentIndex==null)currentIndex=idx;var numImages=list.find('a').size();var thumb=null;if($(this).hasClass("back")){currentIndex=currentIndex-1;if(currentIndex<0)currentIndex=numImages-1;thumb=$(list).find('li:nth-child('+(currentIndex+1)+') a');}else{currentIndex=currentIndex+1;if(currentIndex>numImages-1)currentIndex=0;thumb=$(list).find('li:nth-child('+(currentIndex+1)+') a');}
scrollCurrentThumbIntoView(currentIndex);thumb.click();});jQuery('#lightbox .lightboxPhotoGalleryContent .scrollArrow').click(function(e){e.preventDefault();if(scrollLock)return;var isRight=$(this).hasClass('scrollArrowRight');if(isRight&&page==numPages&&!isAdvantageGallery)return;if(!isRight&&page==1&&!isAdvantageGallery)return;if((page==numPages)&&isAdvantageGallery&&isRight){scrollCurrentThumbIntoView(0);}else if(page==1&&!isRight){scrollCurrentThumbIntoView(numImages);}else{scrollThumbnails(isRight?-1:1);}});function scrollThumbnails(direction){if(direction==0)return;var scrollAmount=navigationScrollAmount;var leftPos=thumnailsCurrentLeft+=(navigationScrollAmount*direction);if(leftPos>0)leftPos=0;if(leftPos<=(thumbnailWidth*numImages*-1))
leftPos=thumbnailWidth*numImages*-1;page-=direction;thumnailsCurrentLeft=leftPos;toggleScrollButtons();scrollLock=true;thumbnails.animate({left:leftPos},thumbnailScrollDuration,function(e){scrollLock=false;});}
function toggleScrollButtons(){var rightButton=jQuery('#lightbox .lightboxPhotoGalleryContent .scrollArrowRight');var leftButton=jQuery('#lightbox .lightboxPhotoGalleryContent .scrollArrowLeft');if(!isAdvantageGallery){if(page==numPages)
rightButton.addClass("nextDisabled");else
rightButton.removeClass("nextDisabled");}
if(!isAdvantageGallery){if(page==1){leftButton.addClass("prevDisabled");}else
leftButton.removeClass("prevDisabled");}}
function scrollCurrentThumbIntoView(thumbIndex){var pageOn=parseInt((thumbIndex+1)/thumnailsVisible)+1;if((thumbIndex+1)%thumnailsVisible==0)pageOn-=1;scrollThumbnails(page-pageOn);}
function init(){$('#lightbox .imageGalleryNavigation li a img').fadeTo(0,thumbFadeTo);var thumbClickedHref=$(galleryDiv).attr('href');if(thumbClickedHref!='#'){$('#lightbox .imageGalleryNavigation li a').each(function(){var href=$(this).attr('href');if(href!=null){var imageToView=href.replace(/^(.*)(view\/[^\/]*)(.*)/,"$2");if(thumbClickedHref.indexOf(imageToView)!=-1)$(this).trigger('click');}});}
else{$('#lightbox .imageGalleryNavigation li:first-child a').trigger('click');}
toggleScrollButtons();}
init();};(function($){$.fn.videoSlideShow=function(options){var self=this;var settings=jQuery.extend({swfUrl:"/merlin-web/flash/videoshell_v1.swf",swfObjectName:"swf_slideshow",minVersion:"8.0.0",height:380,width:455,wmode:"transparent",quality:"high",loop:false,channel:"Van",menu:false,allowScriptAccess:"always",logo:"y",disableBranding:"n",text:"",imageServerUrl:"",imageList:[],cookieName:"ct1Video",maxImages:9},options);function createSWFObject(){var randomNumber=Math.floor(Math.random()*100);var cookieValue=unescape($.cookie(settings.cookieName));self.flash({swf:settings.swfUrl,name:settings.swfObjectName+randomNumber,height:settings.height,width:settings.width,hasVersion:settings.minVersion,wmode:settings.wmode,flashvars:{loop:settings.loop,menu:settings.menu,AllowScriptAccess:settings.allowScriptAccess,logo:settings.logo,disableBranding:settings.disableBranding,txt:encodeURIComponent(settings.text),url:encodeURIComponent(settings.imageServerUrl+"/"),images:getImageListAsString(),cookie:cookieValue}});}
function initControlsSupport(){window.createVar=function(name,value){window[name]=value;};window.createSearchVideoCookie=function(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires)
expires=expires*1000*60*60*24;var expires_date=new Date(today.getTime()+(expires));jQuery.cookie(settings.cookieName,escape(value),{expires:expires,path:path,domain:domain,secure:secure});};window.DoVideo=function(toggle){$.lightbox.close();};}
function getImageListAsString(){var imageString='';var imageCount=0;var numImages=settings.imageList.length>settings.maxImages?settings.maxImages:settings.imageList.length;$.each(settings.imageList,function(index,value){if(imageCount++<numImages){imageString+=value.id+(index!=numImages-1?'|':'');}});return imageString;}
initControlsSupport();createSWFObject();}})(jQuery);namespace("ct1.search.results");ct1.search.results.GalleryHover=function(settings){var advertHoverWidth=498;var advertHoverSelector=".galleryAdvertHover";var advertUrlRegExp=new RegExp(settings.searchServerUrl+"([a-z0-9/-]+)fpa-([a-z0-9]+)(/[a-z0-9/-]+)?");var delayBeforePop=200;var fadeInSpeed=300,fadeOutSpeed=150;var isArticlePage=settings.isArticlePage;var left=30;var leftPos;var offset=jQuery(".searchRight").offset();var searchServerUrl=settings.searchServerUrl;var self=this;var timeoutId=null;var topPos=0;jQuery(".searchRight").mousemove(function(e){topPos=e.pageY-offset.top-105;leftPos=e.pageX-offset.left-10;});if(isArticlePage){var top=-230;}else{var top=4;}
function parseSearchPathFromAdvertUrl(advertUrl){var searchPath=advertUrl.match(advertUrlRegExp)[3];if(searchPath==undefined){searchPath="";}
return searchPath;}
function parseStockItemIdFromAdvertUrl(advertUrl){return advertUrl.match(advertUrlRegExp)[2];}
this.showHover=function(searchResult){var advertUrl=$(".advertUrl",searchResult).attr("href");if(advertUrl!=null){advertUrl=searchServerUrl+"/advert-hover/"+parseStockItemIdFromAdvertUrl(advertUrl)+
parseSearchPathFromAdvertUrl(advertUrl);var hoverContentDiv=jQuery(advertHoverSelector);var w=jQuery(".searchResults").innerWidth();var l=left,t=top;var searchResultJq=jQuery(searchResult);hoverContentDiv.removeClass("advertHoverRight");if(searchResultJq.position().left+advertHoverWidth>w){l=((advertHoverWidth-(searchResultJq.innerWidth()/2))*-1);hoverContentDiv.addClass("advertHoverRight");l+=130;}
if(topPos<0){topPos=0;}
if($("div.content.review").length>0){topPos=-47;}
hoverContentDiv.css("top",topPos+"px");if(isArticlePage){hoverContentDiv.css("left",(searchResultJq.position().left+l)+"px");}else{hoverContentDiv.css("left",leftPos+"px");}
if(hoverContentDiv.data(advertUrl)==null){jQuery.ajax({type:"GET",url:advertUrl,cache:false,complete:function(res){hoverContentDiv.html(res.responseText);hoverContentDiv.data(advertUrl,res.responseText);hoverContentDiv.fadeIn(fadeInSpeed);hoverContentDiv.removeClass("hidden");}});}else{hoverContentDiv.html(hoverContentDiv.data(advertUrl));hoverContentDiv.fadeIn(fadeInSpeed);hoverContentDiv.removeClass("hidden");}}};jQuery(".searchResultGallery a.main").mouseenter(function(){var searchResult=jQuery(this).parent();window.clearTimeout(timeoutId);timeoutId=window.setTimeout(function(){self.showHover(searchResult);if(leftPos>300){jQuery(advertHoverSelector).addClass("advertHoverRight");};},delayBeforePop);});jQuery(".searchResultGallery a.main").mouseleave(function(){window.clearTimeout(timeoutId);});jQuery(advertHoverSelector).mouseleave(function(){var hoverContentDiv=jQuery(advertHoverSelector);hoverContentDiv.fadeOut(fadeOutSpeed);});jQuery(".searchResultGallery").mousemove(function(event){var hoverContentDiv=jQuery(advertHoverSelector);hoverContentDiv.fadeOut(fadeOutSpeed);});};namespace("ct1.search.results");ct1.search.results.help=function(){if(jQuery(".helpTip").length){jQuery(".helpTip").show();jQuery(".helpTip").mouseover(function(){var tipShow=jQuery(this).attr("id");$("."+tipShow).show();$(document).mousemove(function(e){$("."+tipShow).css({"top":e.pageY,"left":e.pageX+3});});}).mouseout(function(){var tipShow=jQuery(this).attr("id");$("."+tipShow).hide();});};};namespace("ct1.search.results");ct1.search.results.init=function(settings){jQuery(".searchResults").searchResults(settings);ct1.initializeFinanceTabs();ct1.search.watchlist.initWatchlistButtons({searchServerUrl:settings.searchServerUrl});ct1.search.results.help();};(function($){jQuery.fn.searchResults=function(settings){var $this=this;var $refinementsWidget;function init(){initGalleryHover();initRefinementsWidget();initSortWidget();initZeroResults();}
function initGalleryHover(){if("gallery".equalsIgnoreCase(settings.layout)){new ct1.search.results.GalleryHover(settings);}}
function initSortWidget(){settings.refinementsWidget=$refinementsWidget;jQuery(".sort select").sortWidget(settings);}
function initRefinementsWidget(){settings.searchResults=$this;$refinementsWidget=jQuery(".searchRefine").refinementsWidget(settings);}
function initZeroResults(){if(settings.totalNumberOfResults==0){jQuery(".zeroResults a.startNew").click(function(){$refinementsWidget.startNewSearch();return false;});}}
this.getLayout=function(){return settings.layout;};this.getSort=function(){return settings.sort;};init();return this;};})(jQuery);(function($){jQuery.fn.sortWidget=function(settings){var $self=this;function handleBrowserBackButton(){if(settings.sort){$self.val(settings.sort);}}
function init(){handleBrowserBackButton();initChange();}
function initChange(){$self.change(function(){var sortParam=$self.val();var googleParam=parseGoogleHack(sortParam);if(ct1.utilities.isNotBlank(googleParam)){if(sortParam.indexOf("&")>0){sortParam=sortParam.substring(0,sortParam.indexOf("&"));}}
var params={sort:sortParam};if(settings.layout){params.layout=settings.layout;}
if(googleParam!=null){params.gquery=googleParam;}
window.location=settings.refinementsWidget.getSearchCriteria().toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/search",params:params});return false;});}
function parseGoogleHack(sortParam){return decodeURIComponent(ct1.utilities.getParameter(sortParam,"gquery"));}
init();return this;};})(jQuery);(function($){jQuery.fn.distanceWidget=function(settings){var $refinementsWidget;var $this=this;function init(){if(settings!=null){$refinementsWidget=settings.refinementsWidget;}
initChangeLocation();initLocationWidget();if($refinementsWidget!=null){initSelectList();}}
function initChangeLocation(){var $changeLocationButton=$("[name=changeLocation]");$changeLocationButton.live('click',function(e){$(this).addClass("hidden");$(this).closest('.townBox').find("input[name=location]").removeClass("hidden").select();return false;});}
function initLocationWidget(){$this.find("input[name=location]").locationWidget({onSelectLocation:function(){if($refinementsWidget!=null){$refinementsWidget.updateSearchResults();}else{location.reload();}}});}
function initSelectList(){var $selectList=$this.find("select");var geoSearchCriterion=$refinementsWidget.getSearchCriteria().getGeoSearchCriterion();if(geoSearchCriterion!=null){$selectList.val(geoSearchCriterion.getRadius());}else{$selectList[0].selectedIndex=0;}
$selectList.change(function(){if(geoSearchCriterion!=null){$refinementsWidget.getSearchCriteria().removeCriterion(geoSearchCriterion);}
if(this.value!="national"){var radius=this.value;var criterion=new ct1.search.criteria.GeoSearchCriterion(radius,"km");$refinementsWidget.getSearchCriteria().addCriterion(criterion);}
$refinementsWidget.updateSearchResults();});}
init();return this;};})(jQuery);(function($){jQuery.fn.keywordsWidget=function(settings){var $refinementsWidget;var $removeKeywordsButton;var $submitButton;var $textField;var $this=this;function init(){$refinementsWidget=settings.refinementsWidget;initRemoveKeywords();initSubmit();initTextField();}
function initRemoveKeywords(){$removeKeywordsButton=jQuery(".changeKey");$removeKeywordsButton.click(function(){$removeKeywordsButton.addClass("hidden");$textField.removeClass("hidden").select();$submitButton.removeClass("hidden");return false;});}
function initSubmit(){$submitButton=$this.find(".submitKeywords");$submitButton.click(function(){submit();return false;});$this.submit(function(){submit();return false;});}
function initTextField(){$textField=$this.find("input");$textField.focus(function(){if($textField.val().startsWith("e.g.")){$textField.val("");$textField.removeClass("example");}else{$textField.select();}
$submitButton.removeAttr("disabled");});}
function submit(){var criterion=new ct1.search.criteria.KeywordCriterion($textField.val());$refinementsWidget.getSearchCriteria().addCriterion(criterion);$refinementsWidget.updateSearchResults();}
init();return this;};})(jQuery);(function($){jQuery.fn.makeModelRefinementsPanel=function(settings){var localSearchCriteria=null;var totalNumberOfResultsExcludingSelections;var makeRefinements=[];var $errorOverlay;var $loadingOverlay;var $makeRefinementsContainer;var $makeRefinementsTemplate;var $modelRefinementsContainer;var $noRefinementsOverlay;var $panel;var $refinementsWidget;var $selectionsContainer;var $selectionCountContainer;var $selectionIndicator;var $selectionsOverlay;var $selectionTemplate;var $this=this;function addCriterion(makeRefinement){var criterion=getCriterion(makeRefinement.name);if(criterion==null){criterion=toNewCriterion(makeRefinement);localSearchCriteria.addCriterion(criterion);}else{$refinementsWidget.getSearchCriteria().removeCriterion(criterion);criterion.setChildValues(getModelValues(makeRefinement));}
$refinementsWidget.getSearchCriteria().addCriterion(criterion);return criterion;}
function calculateTotalNumberOfResults(){var vehicleCount=0;for(var i=0;i<makeRefinements.length;i++){if(makeRefinements[i].selected){vehicleCount+=makeRefinements[i].count;}else if(makeRefinements[i].numberOfSelectedChildren>0){vehicleCount+=makeRefinements[i].selectedChildrenHitsCount;}}
if(vehicleCount==0){vehicleCount=totalNumberOfResultsExcludingSelections;}
return vehicleCount;}
function deselectMake(makeRefinement){makeRefinement.selected=false;makeRefinement.numberOfSelectedChildren=0;makeRefinement.selectedChildrenHitsCount=0;if(makeRefinement.models){for(var i=0;i<makeRefinement.models.length;i++){makeRefinement.models[i].selected=false;}}}
function deselectModel(makeRefinement,modelRefinement){if(makeRefinement.selected){makeRefinement.selected=false;for(var i=0;i<makeRefinement.models.length;i++){if(makeRefinement.models[i].name!=modelRefinement.name){makeRefinement.models[i].selected=true;makeRefinement.numberOfSelectedChildren++;makeRefinement.selectedChildrenHitsCount+=makeRefinement.models[i].count;}}}else{modelRefinement.selected=false;makeRefinement.numberOfSelectedChildren--;makeRefinement.selectedChildrenHitsCount-=modelRefinement.count;}}
function disableSelections(){$selectionsOverlay.removeClass("hidden");$selectionsContainer.find("input").attr("disabled","disabled");}
function enableSelections(){$selectionsOverlay.addClass("hidden");$selectionsContainer.find("input").removeAttr("disabled");}
function getCriterion(makeValue){var criteria=localSearchCriteria.getCriteriaByDimensionName("MakeModel");for(var i=0;i<criteria.length;i++){if(criteria[i].getParentValue()==makeValue){return criteria[i];}}
return null;}
function getMakeRefinement(name){var refinement=null;for(var i=0;i<makeRefinements.length&&refinement==null;i++){if(makeRefinements[i].name==name){refinement=makeRefinements[i];}}
return refinement;}
function getModelRefinement(makeRefinement,modelName){var refinement=null;if(makeRefinement.models){for(var i=0;i<makeRefinement.models.length&&refinement==null;i++){if(makeRefinement.models[i].name==modelName){refinement=makeRefinement.models[i];}}}
return refinement;}
function getModelValues(makeRefinement){var modelValues=[];if(makeRefinement.numberOfSelectedChildren>0){for(var i=0;i<makeRefinement.models.length;i++){if(makeRefinement.models[i].selected){modelValues[modelValues.length]=makeRefinement.models[i].name;}}}
return modelValues;}
function hideLoadingOverlay(){$loadingOverlay.addClass("hidden");}
function hideNoRefinementsOverlay(){$noRefinementsOverlay.addClass("hidden");}
function init(){$errorOverlay=$this.find(".errorOverlayContent");$loadingOverlay=$this.find(".loadingOverlay");$makeRefinementsContainer=$this.find(".makeRefinements")
$makeRefinementsTemplate=$makeRefinementsContainer.find("script[type=text/html]").jsTemplate();$modelRefinementsContainer=$this.find(".modelRefinements")
$noRefinementsOverlay=$this.find(".noRefinementsOverlay");$panel=$this.find(".selectMore");$refinementsWidget=settings.refinementsWidget;$selectionsContainer=$this.find(".refSelections");$selectionCountContainer=$this.find(".selCount");$selectionIndicator=$this.find(".selIndicator");$selectionsOverlay=$this.find(".selectionsOverlay");$selectionTemplate=$selectionsContainer.find("script[type=text/html]").jsTemplate();renderSelections();initCloseButton();initUpdateButton();initOpenPanelButtons();}
function initChooseModels(){jQuery(".chooseModels").click(function(){openModelsOverlay(this.name);return false;});}
function initCloseButton(){$this.find(".closeSelector").click(function(){$this.close();return false;});}
function initCloseModelsOverlayButton(makeRefinement){var $closeButton=$modelRefinementsContainer.find("[name=closeModelsOverlay]");$closeButton.unbind("click");$closeButton.click(function(){$modelRefinementsContainer.addClass("hidden");$makeRefinementsContainer.removeClass("hidden");return false;});}
function initDeselectAllModels(makeRefinement){var $deselectAll=$modelRefinementsContainer.find("[name=deselectAllModels]");$deselectAll.unbind("click");$deselectAll.click(function(){if(makeRefinement.selected||makeRefinement.numberOfSelectedChildren>0){var checkboxes=$modelRefinementsContainer.find(".modelRefinement:not(.hidden) input");checkboxes.removeAttr("checked","checked");deselectMake(makeRefinement);var criterion=removeCriterion(makeRefinement);renderRemoveSelection(criterion);$refinementsWidget.updateTotalNumberOfResults(calculateTotalNumberOfResults());}
return false;});}
function initMakeRefinementCheckboxes(){$makeRefinementsContainer.find("input:checkbox").click(function(){var makeRefinement=getMakeRefinement(this.name);if(makeRefinement.selected||makeRefinement.numberOfSelectedChildren>0){deselectMake(makeRefinement);var criterion=removeCriterion(makeRefinement);renderRemoveSelection(criterion);}else{selectMake(makeRefinement);var criterion=addCriterion(makeRefinement);renderSelection(criterion);}
$refinementsWidget.updateTotalNumberOfResults(calculateTotalNumberOfResults());});}
function initModelsOverlay(makeRefinement){initCloseModelsOverlayButton(makeRefinement);initSelectAllModels(makeRefinement);initDeselectAllModels(makeRefinement);initModelRefinementCheckboxes(makeRefinement);}
function initModelRefinementCheckboxes(makeRefinement){var $checkboxes=$modelRefinementsContainer.find(".modelRefinement:not(.hidden) input");$checkboxes.unbind("click");$checkboxes.click(function(){var modelRefinement=getModelRefinement(makeRefinement,this.name);if(makeRefinement.selected||modelRefinement.selected){deselectModel(makeRefinement,modelRefinement);removeSelection(modelRefinement);var criterion=addCriterion(makeRefinement);renderSelection(criterion);}else{selectModel(makeRefinement,modelRefinement);var criterion=addCriterion(makeRefinement);renderSelection(criterion);}
$refinementsWidget.updateTotalNumberOfResults(calculateTotalNumberOfResults());});}
function removeSelection(refinement){refinement.selected=false;var criterion=getCriterion(refinement.name);localSearchCriteria.removeCriterion(criterion);$refinementsWidget.getSearchCriteria().removeCriterion(criterion);renderRemoveSelection(criterion);}
function initOpenPanelButtons(){var $mainButton=$this.find("a.refTitle");$mainButton.click(function(){$this.open();return false;});var $changeButton=$this.find("a.change");$changeButton.click(function(){$this.open();return false;});}
function initSelectAllModels(makeRefinement){var $selectAll=$modelRefinementsContainer.find("[name=selectAllModels]");$selectAll.unbind("click");$selectAll.click(function(){if(!makeRefinement.selected){var checkboxes=$modelRefinementsContainer.find(".modelRefinement:not(.hidden) input");checkboxes.attr("checked","checked");selectMake(makeRefinement);var criterion=addCriterion(makeRefinement);renderSelection(criterion);$refinementsWidget.updateTotalNumberOfResults(calculateTotalNumberOfResults());}
return false;});}
function initUpdateButton(){$this.find(".updateButton").click(function(){$refinementsWidget.updateSearchResults();return false;});}
function noRefinementsAvailable(){return makeRefinements.length==0;}
function openModelsOverlay(makeName){var makeRefinement=getMakeRefinement(makeName);if(!makeRefinement.models&&makeRefinement.children.length>0){makeRefinement.models=makeRefinement.children;}
if(!makeRefinement.models){refreshModelRefinements(makeRefinement);}else{renderModelsOverlay(makeRefinement);}}
function refreshModelRefinements(makeRefinement){showLoadingOverlay();jQuery.ajax({url:localSearchCriteria.toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/child-refinements",params:{dimension:"MakeModel",parent:makeRefinement.name}}),dataType:"json",type:"GET",cache:false,success:function(refinementResults){makeRefinement.models=refinementResults.refinements;renderModelsOverlay(makeRefinement);hideLoadingOverlay();},error:function(){showErrorOverlay(function(){openModelsOverlay(makeRefinement.name);});}});}
function refreshRefinements(searchCriteria){showLoadingOverlay();showPanel();jQuery.ajax({url:searchCriteria.toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/parent-refinements",params:{dimension:"MakeModel"}}),dataType:"json",type:"GET",cache:false,success:function(refinementResults){setRefinementResults(refinementResults);$makeRefinementsContainer.html($makeRefinementsTemplate.toHtml(refinementResults));$makeRefinementsContainer.find(".truncate").truncate();initMakeRefinementCheckboxes();initChooseModels();localSearchCriteria=searchCriteria.clone();$refinementsWidget.updateTotalNumberOfResults(refinementResults.totalNumberOfResults);hideLoadingOverlay();},error:function(){hideLoadingOverlay();showErrorOverlay(function(){refreshRefinements(searchCriteria);});}});}
function removeCriterion(makeRefinement){var criterion=getCriterion(makeRefinement.name);localSearchCriteria.removeCriterion(criterion);$refinementsWidget.getSearchCriteria().removeCriterion(criterion);return criterion;}
function renderModelsOverlay(makeRefinement){$modelRefinementsContainer.find(".makeName").text(makeRefinement.name);var $modelRefinements=$modelRefinementsContainer.find(".modelRefinement");if($modelRefinements.length<makeRefinement.models.length){var $lastRefinement=jQuery($modelRefinements[$modelRefinements.length-1]);var numberOfModelsToAdd=makeRefinement.models.length-$modelRefinements.length;for(var i=0;i<numberOfModelsToAdd;i++){$lastRefinement.after($lastRefinement.clone());}
$modelRefinements=$modelRefinementsContainer.find(".modelRefinement");}
var refinement;var $refinementContainer;var $checkbox;for(var i=0;i<$modelRefinements.length;i++){$refinementContainer=jQuery($modelRefinements[i]);if(i<makeRefinement.models.length){refinement=makeRefinement.models[i];$checkbox=$refinementContainer.find("input:checkbox");$checkbox.attr("name",refinement.name);if(refinement.selected||makeRefinement.selected){$checkbox.attr("checked","checked");}else{$checkbox.removeAttr("checked");}
$refinementContainer.find(".refinementName").text(refinement.name);$refinementContainer.find(".count").text(ct1.utilities.formatNumber(refinement.count));$refinementContainer.removeClass("hidden");}else{$refinementContainer.addClass("hidden");}}
initModelsOverlay(makeRefinement);$makeRefinementsContainer.addClass("hidden");$modelRefinementsContainer.removeClass("hidden");}
function renderRemoveSelection(criterion){var $selection=$selectionsContainer.find("span:has(input#"+toSelectionId(criterion)+")");$selection.remove();var selectionCount=ct1.utilities.parseFormattedNumber($selectionCountContainer.text());selectionCount--;if(selectionCount==0){$selectionIndicator.addClass("hidden");}
$selectionCountContainer.text(ct1.utilities.formatNumber(selectionCount));if($refinementsWidget.hasOpenPanel()){if($refinementsWidget.isResultsUpToDate()&&!$refinementsWidget.isWebkitLayout()){$refinementsWidget.hideResultsNotUpToDateOverlay();}else{$refinementsWidget.showResultsNotUpToDateOverlay();}};ct1.commadverts.initSearchResultsX01Reposition();}
function renderSelection(criterion){var selectionId=toSelectionId(criterion);var $selection=jQuery($selectionTemplate.toHtml({panelOpen:$this.isOpen(),selectionId:selectionId,selectionName:toSelectionName(criterion)}));$selection.prependTo($selectionsContainer).find("input").click(function(){$refinementsWidget.removeCriterion(criterion);renderRemoveSelection(criterion);return true;});var selectionCount=ct1.utilities.parseFormattedNumber($selectionCountContainer.text());$selectionCountContainer.text(ct1.utilities.formatNumber(selectionCount+1));if(selectionCount==0){$selectionIndicator.removeClass("hidden");}
if($refinementsWidget.isResultsUpToDate()){$refinementsWidget.hideResultsNotUpToDateOverlay();}else{$refinementsWidget.showResultsNotUpToDateOverlay();};ct1.commadverts.initSearchResultsX01Reposition();}
function renderSelections(){var criteria=$refinementsWidget.getSearchCriteria().getCriteriaByDimensionName("MakeModel");for(var i=0;i<criteria.length;i++){renderSelection(criteria[i]);}
ct1.commadverts.initSearchResultsX01Reposition();}
function selectMake(makeRefinement){deselectMake(makeRefinement);makeRefinement.selected=true;}
function selectModel(makeRefinement,modelRefinement){modelRefinement.selected=true;makeRefinement.numberOfSelectedChildren++;makeRefinement.selectedChildrenHitsCount+=modelRefinement.count;}
function setRefinementResults(refinementResults){makeRefinements=refinementResults.refinements;totalNumberOfResultsExcludingSelections=refinementResults.totalNumberOfResultsExcludingSelections;if(noRefinementsAvailable()){showNoRefinementsOverlay();}}
function showErrorOverlay(tryAgainFn){$errorOverlay.removeClass("hidden");var $tryAgainButton=$errorOverlay.find(".tryAgain");$tryAgainButton.click(function(){$errorOverlay.addClass("hidden");tryAgainFn();$tryAgainButton.unbind("click");return false;});}
function showLoadingOverlay(){$loadingOverlay.removeClass("hidden");}
function showNoRefinementsOverlay(){$noRefinementsOverlay.removeClass("hidden");}
function showPanel(){hideNoRefinementsOverlay();var $openPanel=$refinementsWidget.getOpenPanel();if($openPanel!=$this){if($openPanel!=null){$openPanel.close();}
$panel.removeClass("hidden");$panel.removeAttr("style");var portHeight=jQuery(window).height()*0.75;var offset=$panel.offset();var $headerHeight=jQuery("#header").height();var $realTop=offset.top-$headerHeight
$panel.css({position:"absolute",top:$realTop});jQuery(".makeModContent").css("max-height",portHeight-100);disableSelections();}}
function toNewCriterion(makeRefinement){return new ct1.search.criteria.ParentChildDimensionCriterion("MakeModel","Make","Model",makeRefinement.name,getModelValues(makeRefinement));}
function toSelectionId(criterion){if(criterion!=null)
return ct1.search.criteria.toSeoName("MakeModel-"+criterion.getParentValue());}
function toSelectionName(criterion){var name=criterion.getParentValue();var models=criterion.getChildValues();if(models.length>0){if(models.length==1){name+=" "+models[0];}else{name+=" ("+models.length+" models)"}}else{name+=" (All Models)";}
return name;}
this.close=function(){$panel.addClass("hidden");enableSelections();if(!$refinementsWidget.isResultsUpToDate()){$refinementsWidget.showUpdateResultsDialog();}else if($refinementsWidget.isWebkitLayout()){$refinementsWidget.hideResultsNotUpToDateOverlay();}
if(!$modelRefinementsContainer.hasClass("hidden")){$modelRefinementsContainer.addClass("hidden");$makeRefinementsContainer.removeClass("hidden");}};this.isOpen=function(){return!$panel.hasClass("hidden");};this.open=function(){var globalSearchCriteria=$refinementsWidget.getSearchCriteria();if(localSearchCriteria==null||!localSearchCriteria.equals(globalSearchCriteria)){this.refresh();}else{if(noRefinementsAvailable()){showNoRefinementsOverlay();}
showPanel();}
if(!$refinementsWidget.isResultsUpToDate()){$refinementsWidget.hideUpdateResultsDialog();}
if($refinementsWidget.isWebkitLayout()){$refinementsWidget.showResultsNotUpToDateOverlay();}};this.refresh=function(){if(!$modelRefinementsContainer.hasClass("hidden")){localSearchCriteria=$refinementsWidget.getSearchCriteria().clone();var makeName=$modelRefinementsContainer.find(".makeName:first").text();var makeRefinement=getMakeRefinement(makeName);refreshModelRefinements(makeRefinement);}
refreshRefinements($refinementsWidget.getSearchCriteria());};init();return this;};})(jQuery);(function($){jQuery.fn.multiSelectRefinementsPanel=function(settings){var dimensionName;var localSearchCriteria=null;var refinements=[];var totalNumberOfResultsExcludingSelections;var $errorOverlay;var $loadingOverlay;var $noRefinementsOverlay;var $panel;var $refinementsContainer;var $refinementsTemplate;var $refinementsWidget;var $selectionsContainer;var $selectionCountContainer;var $selectionIndicator;var $selectionsOverlay;var $selectionTemplate;var $this=this;function addSelection(refinement){refinement.selected=true;var criterion=new ct1.search.criteria.SimpleDimensionCriterion(dimensionName,refinement.name);localSearchCriteria.addCriterion(criterion);$refinementsWidget.getSearchCriteria().addCriterion(criterion);renderAddSelection(criterion);}
function calculateTotalNumberOfResults(){var vehicleCount=0;for(var i=0;i<refinements.length;i++){if(refinements[i].selected){vehicleCount+=refinements[i].count;}}
if(vehicleCount==0){vehicleCount=totalNumberOfResultsExcludingSelections;}
return vehicleCount;}
function disableSelections(){$selectionsOverlay.removeClass("hidden");$selectionsContainer.find("input").attr("disabled","disabled");}
function enableSelections(){$selectionsOverlay.addClass("hidden");$selectionsContainer.find("input").removeAttr("disabled");}
function getCriterion(value){var criterion=null;var criteria=localSearchCriteria.getCriteriaByDimensionName(dimensionName);for(var i=0;i<criteria.length&&criterion==null;i++){if(criteria[i].getValue()==value){criterion=criteria[i];}}
return criterion;}
function getRefinement(name){var refinement=null;for(var i=0;i<refinements.length&&refinement==null;i++){if(refinements[i].name==name){refinement=refinements[i];}}
return refinement;}
function hideLoadingOverlay(){$loadingOverlay.addClass("hidden");}
function hideNoRefinementsOverlay(){$noRefinementsOverlay.addClass("hidden");}
function hideRefinementsContainer(){$refinementsContainer.addClass("hidden");}
function init(){dimensionName=$this.find("a.refTitle").attr("name");$errorOverlay=$this.find(".errorOverlayContent");$loadingOverlay=$this.find(".loadingOverlay");$noRefinementsOverlay=$this.find(".noRefinementsOverlay");$panel=$this.find(".selectMore");$refinementsContainer=$this.find(".selectContent");$refinementsTemplate=$refinementsContainer.find("script[type=text/html]").jsTemplate();$refinementsWidget=settings.refinementsWidget;$selectionsContainer=$this.find(".refSelections");$selectionCountContainer=$this.find(".selCount");$selectionIndicator=$this.find(".selIndicator");$selectionsOverlay=$this.find(".selectionsOverlay");$selectionTemplate=$selectionsContainer.find("script[type=text/html]").jsTemplate();renderSelections();initCloseButton();initUpdateButton();initOpenPanelButtons();}
function initCloseButton(){$this.find(".closeSelector").click(function(){$this.close();return false;});}
function initOpenPanelButtons(){var $mainButton=$this.find("a.refTitle");$mainButton.click(function(){$this.open();return false;});var $changeButton=$this.find("a.change");$changeButton.click(function(){$this.open();return false;});}
function initRefinementCheckboxes(){$refinementsContainer.find("input:checkbox").click(function(){var refinement=getRefinement(this.name);if(refinement.selected){removeSelection(refinement);}else{addSelection(refinement);}
$refinementsWidget.updateTotalNumberOfResults(calculateTotalNumberOfResults());});}
function initUpdateButton(){$this.find(".updateButton").click(function(){$refinementsWidget.updateSearchResults();return false;});}
function noRefinementsAvailable(){return refinements.length==0;}
function refreshRefinements(searchCriteria){hideRefinementsContainer();showLoadingOverlay();showPanel();jQuery.ajax({url:searchCriteria.toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/multiselect-refinements",params:{dimension:dimensionName}}),dataType:"json",type:"GET",cache:false,success:function(refinementResults){setRefinementResults(refinementResults);$refinementsContainer.html($refinementsTemplate.toHtml({popularRefinementsLimit:refinementResults.popularRefinementsLimit,refinements:refinementResults.refinements,refinementsWidget:$refinementsWidget,panel:$this}));$refinementsContainer.find(".truncate").truncate();initRefinementCheckboxes();localSearchCriteria=searchCriteria.clone();$refinementsWidget.updateTotalNumberOfResults(refinementResults.totalNumberOfResults);hideLoadingOverlay();showRefinementsContainer();},error:function(){hideLoadingOverlay();showErrorOverlay(function(){refreshRefinements(searchCriteria);});}});}
function removeSelection(refinement){refinement.selected=false;var criterion=getCriterion(refinement.name);localSearchCriteria.removeCriterion(criterion);$refinementsWidget.getSearchCriteria().removeCriterion(criterion);renderRemoveSelection(criterion);}
function renderAddSelection(criterion){$selectionsContainer.prepend($selectionTemplate.toHtml({panelOpen:$this.isOpen(),selectionId:toSelectionId(criterion),selectionName:toSelectionName(criterion)}))
var selectionCount=ct1.utilities.parseFormattedNumber($selectionCountContainer.text());$selectionCountContainer.text(ct1.utilities.formatNumber(selectionCount+1));if(selectionCount==0){$selectionIndicator.removeClass("hidden");}
if($refinementsWidget.isResultsUpToDate()){$refinementsWidget.hideResultsNotUpToDateOverlay();}else{$refinementsWidget.showResultsNotUpToDateOverlay();}
ct1.commadverts.initSearchResultsX01Reposition();}
function renderSelections(){var criteria=$refinementsWidget.getSearchCriteria().getCriteriaByDimensionName(dimensionName);if(criteria.length<=0){return;}
var selectionHtml="";for(var i=0;i<criteria.length;i++){var criterion=criteria[i];selectionHtml=selectionHtml+$selectionTemplate.toHtml({panelOpen:$this.isOpen(),selectionId:toSelectionId(criterion),selectionName:toSelectionName(criterion)});}
$selectionsContainer.append(selectionHtml).find("input").click(function(){var criterion=new ct1.search.criteria.SimpleDimensionCriterion(dimensionName,jQuery.trim($(this).closest("span").text()));$refinementsWidget.removeCriterion(criterion);renderRemoveSelection(criterion);return true;});for(var i=0;i<criteria.length;i++){var selectionCount=ct1.utilities.parseFormattedNumber($selectionCountContainer.text());$selectionCountContainer.text(ct1.utilities.formatNumber(selectionCount+1));if(selectionCount==0){$selectionIndicator.removeClass("hidden");}}
if($refinementsWidget.isResultsUpToDate()){$refinementsWidget.hideResultsNotUpToDateOverlay();}else{$refinementsWidget.showResultsNotUpToDateOverlay();}
ct1.commadverts.initSearchResultsX01Reposition();}
function renderRemoveSelection(criterion){var $selection=$selectionsContainer.find("span:has(input#"+toSelectionId(criterion)+")");$selection.remove();var selectionCount=ct1.utilities.parseFormattedNumber($selectionCountContainer.text());selectionCount--;if(selectionCount==0){$selectionIndicator.addClass("hidden");}
$selectionCountContainer.text(ct1.utilities.formatNumber(selectionCount));if($refinementsWidget.hasOpenPanel()){if($refinementsWidget.isResultsUpToDate()&&!$refinementsWidget.isWebkitLayout()){$refinementsWidget.hideResultsNotUpToDateOverlay();}else{$refinementsWidget.showResultsNotUpToDateOverlay();}}
ct1.commadverts.initSearchResultsX01Reposition();}
function setRefinementResults(refinementResults){refinements=refinementResults.refinements;totalNumberOfResultsExcludingSelections=refinementResults.totalNumberOfResultsExcludingSelections;if(noRefinementsAvailable()){showNoRefinementsOverlay();}}
function showErrorOverlay(tryAgainFn){$errorOverlay.removeClass("hidden");var $tryAgainButton=$errorOverlay.find(".tryAgain");$tryAgainButton.click(function(){$errorOverlay.addClass("hidden");tryAgainFn();$tryAgainButton.unbind("click");return false;});}
function showLoadingOverlay(){$loadingOverlay.removeClass("hidden");}
function showNoRefinementsOverlay(){$noRefinementsOverlay.removeClass("hidden");}
function showRefinementsContainer(){$refinementsContainer.removeClass("hidden");}
function showPanel(){hideNoRefinementsOverlay();var $openPanel=$refinementsWidget.getOpenPanel();if($openPanel!=$this){if($openPanel!=null){$openPanel.close();}
$panel.removeClass("hidden");$panel.removeAttr("style");var portHeight=jQuery(window).height()*0.75;var offset=$panel.offset();var $headerHeight=jQuery("#header").height();var $realTop=offset.top-$headerHeight
$panel.css({position:"absolute",top:$realTop});jQuery(".selectContent").css("max-height",portHeight-100);disableSelections();}}
function toSelectionId(criterion){return ct1.search.criteria.toSeoName(dimensionName+"-"+criterion.getValue());}
function toSelectionName(criterion){return criterion.getValue();}
this.close=function(){$panel.addClass("hidden");enableSelections();if(!$refinementsWidget.isResultsUpToDate()){$refinementsWidget.showUpdateResultsDialog();}else if($refinementsWidget.isWebkitLayout()){$refinementsWidget.hideResultsNotUpToDateOverlay();}};this.isOpen=function(){return!$panel.hasClass("hidden");};this.open=function(){var globalSearchCriteria=$refinementsWidget.getSearchCriteria();if(localSearchCriteria==null||!localSearchCriteria.equals(globalSearchCriteria)){refreshRefinements(globalSearchCriteria);}else{if(noRefinementsAvailable()){showNoRefinementsOverlay();}
showPanel();}
if(!$refinementsWidget.isResultsUpToDate()){$refinementsWidget.hideUpdateResultsDialog();}
if($refinementsWidget.isWebkitLayout()){$refinementsWidget.showResultsNotUpToDateOverlay();}};this.refresh=function(){refreshRefinements($refinementsWidget.getSearchCriteria());};init();return this;};})(jQuery);(function($){jQuery.fn.refinementsWidget=function(settings){var panels=[];var searchCriteria;var unchangedSearchCriteria;var $resultsNotUpToDateOverlay;var $searchResults;var $this=this;var $updateResultsDialog;var $vehicleCounter;function init(){searchCriteria=ct1.search.criteria.SearchCriteria.fromJson(settings.jsonSearchCriteria);unchangedSearchCriteria=searchCriteria.clone();$searchResults=settings.searchResults;settings.refinementsWidget=$this;initDistanceWidget();initKeywordsWidget();initVehicleCounter();initUpdateResultsDialog();initPanels();}
function initDistanceWidget(){$this.find(".townBox").distanceWidget(settings);}
function initKeywordsWidget(){$this.find("form:has(input[name=keywords])").keywordsWidget(settings);}
function initPanels(){var refinementPanels=$this.find(".refinement");refinementPanels.each(function(){var $thisPanel=jQuery(this);var anchor=$thisPanel.find("a.refTitle");if(anchor.length){if(anchor.attr("name")=="MakeModel"){panels[panels.length]=$thisPanel.makeModelRefinementsPanel(settings);}else{panels[panels.length]=$thisPanel.multiSelectRefinementsPanel(settings);}}});}
function initUpdateResultsDialog(){$resultsNotUpToDateOverlay=jQuery(".searchOverlay");$updateResultsDialog=$resultsNotUpToDateOverlay.find(".youSearched");$updateResultsDialog.find(".update").click(function(){$this.updateSearchResults();return false;});$updateResultsDialog.find(".cancel").click(function(){searchCriteria=unchangedSearchCriteria.clone();$this.hideResultsNotUpToDateOverlay();$this.hideUpdateResultsDialog();$this.updateSearchResults();return false;});}
function initVehicleCounter(){$vehicleCounter=jQuery(".vehicleCounter").vehicleCounter(settings);}
this.closeOpenPanel=function(){var openPanel=this.getOpenPanel();if(openPanel!=null){openPanel.close();}};this.getOpenPanel=function(){var panel=null;for(var i=0;i<panels.length&&panel==null;i++){if(panels[i].isOpen()){panel=panels[i];}}
return panel;};this.getSearchCriteria=function(){return searchCriteria;};this.getTotalNumberOfResults=function(){return $vehicleCounter.getValue();};this.hasOpenPanel=function(){return this.getOpenPanel()!=null;};this.hideResultsNotUpToDateOverlay=function(){$resultsNotUpToDateOverlay.addClass("hidden");};this.hideUpdateResultsDialog=function(){$updateResultsDialog.addClass("hidden");};this.isResultsUpToDate=function(){return searchCriteria.equals(unchangedSearchCriteria);};this.isWebkitLayout=function(){return jQuery(".searchOverlay").hasClass("webkitLayout");}
this.removeCriterion=function(criterion){searchCriteria.removeCriterion(criterion);var resultsUpToDate=this.isResultsUpToDate();var $openPanel=this.getOpenPanel();if($openPanel==null){if(!resultsUpToDate){$this.updateSearchResults();}}else{$openPanel.refresh();}
if(resultsUpToDate){this.hideUpdateResultsDialog();this.hideResultsNotUpToDateOverlay();}};this.showResultsNotUpToDateOverlay=function(){$resultsNotUpToDateOverlay.removeClass("hidden");};this.showUpdateResultsDialog=function(){$updateResultsDialog.removeClass("hidden");};this.startNewSearch=function(){searchCriteria.removeAllCriteria();this.updateSearchResults();};this.updateSearchResults=function(){var params={};params.layout=$searchResults.getLayout();params.sort=$searchResults.getSort();window.location=searchCriteria.toSearchUrl({searchServerUrl:settings.searchServerUrl,searchPath:"/search",params:params});};this.updateTotalNumberOfResults=function(totalNumResults){$vehicleCounter.setValue(totalNumResults);};init();return this;};})(jQuery);namespace("ct1.search.watchlist");ct1.search.watchlist.initWatchlistButtons=function(settings){var searchServerUrl=settings.searchServerUrl;activateWatchlistButtons();function activateWatchlistButtons(){jQuery(".addAdvertToWatchlist").live("click",function(){addItemToWatchlist("advert",jQuery(this).parent());return false;});jQuery(".addDealerToWatchlist").live("click",function(){addItemToWatchlist("dealer",jQuery(this).parent());return false;});jQuery(".add-to-watch-list").removeClass("hidden");}
function parseLinksPos(omnitureParams){var indexLinksPosStart=omnitureParams.indexOf("linksPos=")+"linksPos=".length;var indexLinksPosEnd=omnitureParams.indexOf("|",indexLinksPosStart);if(indexLinksPosEnd<0){indexLinksPosEnd=omnitureParams.length;}
return omnitureParams.substring(indexLinksPosStart,indexLinksPosEnd);}
function addItemToWatchlist(itemType,$container){var itemId=$container.children("a").attr("name");if(ct1.signIn.isUserSignedIn()){var $statusContainer=$container.children(".watchlistStatus");$statusContainer.children(".error").removeClass("hidden");$statusContainer.addClass("watchlist-loading");var linksPos=parseLinksPos($container.children("var.tracking").attr("title"));jQuery.ajax({url:searchServerUrl+"/watchlist/save-"+itemType+"/"+itemId+"?linksPos="+linksPos,dataType:"html",type:"GET",cache:false,success:function(responseHtml){if(responseHtml.trim().length==0){this.error();}else{$container.removeClass("add-to-watch-list");$container.addClass("saved-to-watch-list");$statusContainer.removeClass("watchlist-loading");$container.html(responseHtml);}},error:function(){$statusContainer.removeClass("watchlist-loading");$statusContainer.children(".watchlistError").removeClass("hidden");}});}else{ct1.search.watchlist.pleaseSignInToAddItemToWatchlist(itemId);}}};ct1.search.watchlist.addItemToWatchlistAfterSignIn=function(){jQuery(".addToWatchlistAfterSignIn").removeClass("addToWatchlistAfterSignIn").click();};ct1.search.watchlist.pleaseSignInToAddItemToWatchlist=function(itemId){jQuery(".addToWatchlistAfterSignIn").removeClass("addToWatchlistAfterSignIn");jQuery(".add-to-watch-list a[name="+itemId+"]").addClass("addToWatchlistAfterSignIn");ct1.signIn.executeAfterSignIn(function(){ct1.search.watchlist.addItemToWatchlistAfterSignIn();});jQuery(".lightboxSignIn").click();};ct1.omnitureTrackingHandler=function(setTrackingData){var parsedTrackingData=ct1.omnitureClickTrackingDataParser().parse(ct1.omnitureUtils.pageName(),ct1.omnitureUtils.channelName(),setTrackingData);var tracker=new ct1.WebAnalyticsService();tracker.clickTrack({anchor:this,pageName:parsedTrackingData.pageName,linkPageName:parsedTrackingData.pageLinkName,linkName:parsedTrackingData.linkName,linksPos:parsedTrackingData.linksPos,pageAndLinkName:parsedTrackingData.pageAndLinkName,linkPosition:parsedTrackingData.linkPosition,pageNameAndLinkPosition:parsedTrackingData.pageNameAndLinkPosition,linkAndPageNameAndLinkPosition:parsedTrackingData.linkAndPageNameAndLinkPosition,linkDescription:parsedTrackingData.linkDescription,events:parsedTrackingData.events});};ct1.sauronTracking=function(){jQuery(".omnitureTrackingConfirm").live('click',function(e){var trackingData=function(clickedLink){if(jQuery(clickedLink).next("span.tracking")[0]){return jQuery(clickedLink).next("span.tracking").text();}else if(jQuery(clickedLink).next("var.tracking")[0]){return jQuery(clickedLink).next("var.tracking").attr("title");}};var setTrackingData=trackingData(this);function repeatcheck(){setTimeout(function(){if(jQuery(".fcOver").length){var t=setTimeout(function(){repeatcheck()},200);}else{if(jQuery(".olaerror").length){}else{ct1.omnitureTrackingHandler(setTrackingData);};};});};repeatcheck();});jQuery(".omnitureTracking").live("click",function(e){var trackingData=function(clickedLink){if(jQuery(clickedLink).next("span.tracking")[0]){return jQuery(clickedLink).next("span.tracking").text();}else if(jQuery(clickedLink).next("var.tracking")[0]){return jQuery(clickedLink).next("var.tracking").attr("title");}};var setTrackingData=trackingData(this);ct1.omnitureTrackingHandler(setTrackingData);});};ct1.legacyTracking=function(){_hbLink=function(lid,lpos){var trackingData=function(){var data="subSection="+lpos+"|linkName="+lid;return data;};var setTrackingData=trackingData(this);ct1.omnitureTrackingHandler(setTrackingData);};trackClick=function(lid,lpos,desc,eve,anc){var trackingData=function(){var data="events="+eve+"|subSection="+lpos+"|linkName="+lid+"|linkDesc="+desc;return data;};var setTrackingData=trackingData(this);ct1.omnitureTrackingHandler(setTrackingData);};};ct1.omnitureClickTracking=function(){ct1.sauronTracking();ct1.legacyTracking();};ct1.omnitureClickTrackingDataParser=function(){var that={};var combineChannelAndPageName=function(channelName,pageName){if(typeof pageName!=='undefined'){if(pageName.indexOf(channelName)===-1){pageName=channelName+":"+pageName;}}
return pageName;};var parseData=function(data){var valuePairs=data.split("|");var trackingData={};for(var valuePair in valuePairs){if(valuePairs.hasOwnProperty(valuePair)){var keyValue=valuePairs[valuePair].split("=");if(keyValue[1]){trackingData[keyValue[0].trim()]=keyValue[1].trim();}}}
return trackingData;};var pageAndLinkName=function(channelAndPageName,linkName){return channelAndPageName+"|"+linkName;};var theLinkPos=function(linksPos){return linksPos;};var pageNameAndLinkPosition=function(trackingData){var getModuleName=function(){var moduleName=trackingData.moduleName;if(!moduleName){moduleName=trackingData.subSection;}
return moduleName;};var getSubName=function(){var subName=trackingData.subName;if(!subName){subName=trackingData.subSection2;}
return subName;};trackingData.linkPosition=getModuleName();if(getSubName()){trackingData.linkPosition=trackingData.linkPosition+"1_"+getSubName();}
return trackingData.pageName+","+trackingData.linkPosition;};var linkAndPageNameAndLinkPosition=function(trackingData){return trackingData.linkName+","+pageNameAndLinkPosition(trackingData);};var linkDescription=function(trackingData){var linkDesc=trackingData.linkDesc;if(!linkDesc){linkDesc=trackingData.linkName;}
return linkDesc;};that.parse=function(pageName,channelName,data){var trackingData=parseData(data);if(!trackingData.events){trackingData.events="event20";}
var channelAndPageName=combineChannelAndPageName(channelName,pageName);trackingData.pageName=channelAndPageName;trackingData.pageLinkName=channelAndPageName;trackingData.pageAndLinkName=pageAndLinkName(channelAndPageName,trackingData.linkName);trackingData.theLinkPos=theLinkPos(trackingData.linksPos);trackingData.pageNameAndLinkPosition=pageNameAndLinkPosition(trackingData);trackingData.linkAndPageNameAndLinkPosition=linkAndPageNameAndLinkPosition(trackingData);trackingData.linkDescription=linkDescription(trackingData);return trackingData;};return that;};ct1.omnitureUtils={addEvent:function(event){var $events=jQuery("#events");if($events.length==0){$events=jQuery("<div class='setPageTracking' id='events' title=''></div>");jQuery("body").append($events);}
var events=$events.attr("title");if(ct1.utilities.isNotBlank(events)){events+=",";}
events+=event;$events.attr("title",events);},channelName:function(){if(typeof s!=='undefined'){if(typeof s.channel!=='undefined'){return s.channel;}}else{var theChannel=$("body").attr("class");return theChannel;}},handleTrackingVariables:function(lightBoxClosing){if($("body").data('originalTrackingVariables')!=null){$('.setPageTracking').remove();if($("#lightbox .setPageTrackingLightBox").length===0||lightBoxClosing)
$("body").append($("body").data('originalTrackingVariables'));}
else{$("body").data('originalTrackingVariables',$('.setPageTracking').clone());}},pageName:function(){if(typeof s!=='undefined'){if(typeof s.pageName!=='undefined'){return s.pageName;}}else{var thePage=$("#pageName").attr("title");return thePage;}}};namespace("ct1.trackingCleaner");ct1.trackingCleaner.clean=function(opts){var settings={};if(opts!=null){settings=opts;}
ct1.omnitureUtils.handleTrackingVariables(settings.lightBoxClosing);if(jQuery("body").attr("class")==""){jQuery("#channel").attr("title","commercial");}
var userCookie=new ct1.UserCookie(jQuery.cookie("ctuser"));var trackingU=userCookie.getId();jQuery("#userId").attr("title",trackingU);var userService=new ct1.UserService(userCookie);var loginYN=userService.getSignedInStatus();jQuery("#loggedInUser").attr("title",loginYN);var searchURL=window.location.toString();if(searchURL.indexOf("/dealer/")!=-1){if(searchURL.indexOf("/advert")==-1){jQuery("#subSection4").attr("title",":d_"+jQuery("#subSection4").attr("title"));var sDID=searchURL.split("/dealer/");sDID.splice(0,1);var sDIDIS=sDID[0].split("/");jQuery("#contentTitle").attr("title","dealer_search_"+sDIDIS[0]);}}else{if(jQuery("#subSection4").attr("title")!=""){jQuery("#subSection4").attr("title",":"+jQuery("#subSection4").attr("title"));}}
jQuery("#subSection").attr("title",jQuery("#siteSection").attr("title")+":"+jQuery("#contentType").attr("title"));jQuery("#subSection2").attr("title",jQuery("#subSection").attr("title")+jQuery("#subSection2").attr("title"));jQuery("#subSection3").attr("title",jQuery("#subSection2").attr("title")+jQuery("#subSection3").attr("title"));jQuery("#subSection4").attr("title",jQuery("#subSection3").attr("title")+jQuery("#subSection4").attr("title"));jQuery("#pageName").attr("title",jQuery("#subSection4").attr("title"));jQuery("#hierarchy").attr("title",jQuery("#subSection4").attr("title").toString().replace(/:/g,","));var $siteVersion=jQuery("#siteVersion");$siteVersion.attr("title",$siteVersion.attr("title")+jQuery("#subSection4").attr("title"));if(searchURL.indexOf("/make/")!=-1){var vehMake=searchURL.split("/make/");vehMake.splice(0,1);var makesCulminated;for(var i=0;i<vehMake.length;i++){var vehIS=vehMake[i].split("/");var makeSeparator=",";jQuery("#make").attr("title",jQuery("#make").attr("title")+makeSeparator+vehIS[0]);if(makesCulminated==undefined){makesCulminated=vehIS[0];}else{makesCulminated=makesCulminated+","+vehIS[0];}}
if(jQuery("#make").attr("title")!=undefined){var makeId=jQuery("#make").attr("title").toString().replace(",","|");jQuery("#make").attr("title",makeId);}}else{jQuery("#make").attr("title",jQuery("#make").attr("title")+"|any_make");}
if(searchURL.indexOf("/model/")!=-1){var vehMake=searchURL.split("/make/");vehMake.splice(0,1);for(var i=0;i<vehMake.length;i++){var vehModel=vehMake[i].split("/model/");var modelsCulminated;for(var m=1;m<vehModel.length;m++){var modelsMake=vehModel[0].toString();var splitvehModel=vehModel[m].split("/");splitvehModel.splice(1,100);var modelSeparator=",";jQuery("#model").attr("title",jQuery("#model").attr("title")+modelSeparator+splitvehModel);if(modelsCulminated==undefined){modelsCulminated=splitvehModel;}else{modelsCulminated=modelsCulminated+","+splitvehModel;}}}
if(jQuery("#model").attr("title")!=undefined){var modelId=jQuery("#model").attr("title").toString().replace(",","|");jQuery("#model").attr("title",modelId);}}else{jQuery("#model").attr("title",jQuery("#model").attr("title")+"|any_model");}
var $uniqueSearchUrl=jQuery("#uniqueSearchUrl");if($uniqueSearchUrl.length>0){var uniqueSearchUrl=$uniqueSearchUrl.attr("title");var lastUniqueSearchUrl=jQuery.cookie("surl");if(lastUniqueSearchUrl==null||!lastUniqueSearchUrl.equalsIgnoreCase(uniqueSearchUrl)){ct1.omnitureUtils.addEvent("event1");jQuery.cookie("surl",uniqueSearchUrl,{path:"/"});}}};ct1.OmnitureConfig=(function(){var _instance=null;function createInstance(data){return{getAccountId:function(){return data.accountId;}};}
return{getInstance:function(){if(_instance==null){throw new Error("OmnitureConfig has not been initialised!");}
return _instance;},initialize:function(data){_instance=createInstance(data);}};})();ct1.WebAnalyticsService=function(){};ct1.WebAnalyticsService.setOmniture=function(s){if(!s.trackDownloadLinks){s.trackDownloadLinks=true;}
if(!s.trackExternalLinks){s.trackExternalLinks=true;}
if(!s.trackInlineStats){s.trackInlineStats=true;}
if(!s.linkDownloadFileTypes){s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,pdf,doc,docx,xls,xlsx,ppt,pptx,hqx,dmg";}
if(!s.linkInternalFilters){s.linkInternalFilters="javascript:,autotrader.co.za";}
if(!s.cookieDomainPeriods){s.cookieDomainPeriods="3";}
if(!s.linkLeaveQueryString){s.linkLeaveQueryString=false;}
if(!s.linkTrackVars){s.linkTrackVars="None";}
if(!s.linkTrackEvents){s.linkTrackEvents="None";}
if(!s.formList){s.formList="";}
if(!s.trackFormList){s.trackFormList=true;}
if(!s.trackPageName){s.trackPageName=true;}
if(!s.useCommerce){s.useCommerce=true;}
if(!s.varUsed){s.varUsed="eVar38";}
if(!s.eventList){s.eventList="event9,event10,event11";}
s.dstStart="03/29/"+new Date().getFullYear();s.dstEnd="10/25/"+new Date().getFullYear();s.currentYear=+new Date().getFullYear();s.visitorNamespace="tradermediagroup";s.trackingServer="metrics.autotrader.co.za";s.trackingServerSecure="smetrics.autotrader.co.za";s.dc=122;};ct1.WebAnalyticsService.cleanData=function(str){if(typeof str!=='undefined'){if(str.charAt(0)==="/"){str=str.substr(1);}
var strl=str.length-1;if(str.charAt(strl)==="/"||str.charAt(strl)==="+"){str=str.substring(0,strl);}
str=str.replace(/^\s+|\s+$/g,'').replace(/\s+/g,'_').replace(/\+/g,"_");return str.replace(/\//g,":").replace(/\&amp;/g,"&").replace(/[^A-Za-z0-9_,:,|]/g,"").toLowerCase();}};ct1.WebAnalyticsService.prototype.clickTrack=function(data){if(typeof data.linkPageName!=='undefined'){var s_account=ct1.OmnitureConfig.getInstance().getAccountId();var s=s_gi(s_account);ct1.WebAnalyticsService.setOmniture(s);var pageName=ct1.WebAnalyticsService.cleanData(data.pageName);var linkPageName=ct1.WebAnalyticsService.cleanData(data.linkPageName);var linkName=ct1.WebAnalyticsService.cleanData(data.linkName);var linksPos=ct1.WebAnalyticsService.cleanData(data.linksPos);var pageAndLinkName=ct1.WebAnalyticsService.cleanData(data.pageAndLinkName);var linkPosition=ct1.WebAnalyticsService.cleanData(data.linkPosition);var pageNameAndLinkPosition=ct1.WebAnalyticsService.cleanData(data.pageNameAndLinkPosition);var linkAndPageNameAndLinkPosition=ct1.WebAnalyticsService.cleanData(data.linkAndPageNameAndLinkPosition);var linkDescription=ct1.WebAnalyticsService.cleanData(data.linkDescription);var events=data.events;var anchor=data.anchor;s.events="None";s.linkTrackVars="events,prop33,prop34,prop35,prop36,prop37,eVar54,eVar55,eVar56,eVar57,eVar58";s.linkTrackEvents=events;s.events=events;s.usePlugins=false;if((s.pageName!==undefined)&&(s.pageName!==pageName)){pageName=s.pageName;}
s.pageName=pageName;s.prop33=pageName;s.eVar54=s.prop33;s.prop34=linkName;s.eVar55=s.prop34;s.prop35=pageName+"|"+linkName;s.eVar56=s.prop35;s.prop36=linksPos;s.eVar57=s.prop36;s.prop37=pageName+"|"+linksPos+"|"+linkName;s.eVar58=s.prop37;if(anchor===undefined||anchor.href===undefined){anchor={};anchor.href="http://www.dummyhref.com";}
s.tl(anchor,"o",linkDescription);s.events="";s.prop33="";s.eVar54="";s.prop34="";s.eVar55="";s.prop35="";s.eVar56="";s.prop36="";s.eVar57="";s.prop37="";s.eVar58="";s.usePlugins=true;}};ct1.WebAnalyticsService.prototype.trackPage=function(data){var s_account=ct1.OmnitureConfig.getInstance().getAccountId();var s=s_gi(s_account);ct1.WebAnalyticsService.setOmniture(s);s.usePlugins=true;var s_doct1Plugins=function(s){s.events=s.apl(s.events,"event2",",",1);s.setupFormAnalysis();s.prop25=s.getDaysSinceLastVisit();s.prop26=s.getNewRepeat(90);if(s.prop1&&!s.eVar1){s.eVar1=s.prop1;}
if(s.prop2&&!s.eVar2){s.eVar2=s.prop2;}
if(s.prop3&&!s.eVar3){s.eVar3=s.prop3;}
if(s.prop4&&!s.eVar4){s.eVar4=s.prop4;}
if(s.prop5&&!s.eVar5){s.eVar5=s.prop5;}
if(s.prop6&&!s.eVar6){s.eVar6=s.prop6;}
if(s.prop7&&!s.eVar7){s.eVar7=s.prop7;}
if(s.prop15){if(!s.eVar15){s.eVar15=s.prop15;}
if(!s.eVar39){s.eVar39=s.prop15;}}
if(s.prop16&&!s.eVar16){s.eVar16=s.prop16;}
if(s.prop17&&!s.eVar17){s.eVar17=s.prop17;}
if(s.prop25&&!s.eVar25){s.eVar25=s.prop25;}
if(s.prop26&&!s.eVar26){s.eVar26=s.prop26;}
if(s.prop29&&!s.eVar29){s.eVar29=s.prop29;}
if(s.prop30&&!s.eVar30){s.eVar30=s.prop30;}
if(s.prop31&&!s.eVar31){s.eVar31=s.prop31;}
if(s.prop32&&!s.eVar32){s.eVar32=s.prop32;}
if(s.prop40&&!s.eVar40){s.eVar40=s.prop40;}
s.prop41=location.pathname;if(s.prop41&&!s.eVar41){s.eVar41=s.prop41;}
if(s.prop43&&!s.eVar43){s.eVar43=s.prop43;}
s.prop44="D=referrer";if(s.prop44&&!s.eVar44){s.eVar44=s.prop44;}
if(s.prop47&&!s.eVar47){s.eVar47=s.prop47;}
if(s.prop50&&!s.eVar50){s.eVar50=s.prop50;}
s.prop53="D=pid";s.prop54="D=oid";s.campaign=s.getQueryParam('atzacida,atzacidb,atzacide,atzacidk,atzacido, atzacids',':');s.campaign=s.getValOnce(s.campaign,'s_campaign',0);if(s.pageName&&!s.eVar35){s.eVar35=s.pageName;}
if(s.channel&&!s.eVar36){s.eVar36=s.channel;}
s.prop9=s.getTimeParting('h','+0');s.prop10=s.getTimeParting('d','+0');s.prop11=s.getTimeParting('w','+0');};s.doPlugins=s_doct1Plugins;s.getPreviousValue=new Function("v","c","el",""
+"var s=this,t=new Date,i,j,r='';t.setTime(t.getTime()+1800000);if(el"
+"){if(s.events){i=s.split(el,',');j=s.split(s.events,',');for(x in i"
+"){for(y in j){if(i[x]==j[y]){if(s.c_r(c)) r=s.c_r(c);v?s.c_w(c,v,t)"
+":s.c_w(c,'no value',t);return r}}}}}else{if(s.c_r(c)) r=s.c_r(c);v?"
+"s.c_w(c,v,t):s.c_w(c,'no value',t);return r}");s.getPercentPageViewed=new Function("",""
+"var s=this;if(typeof(s.linkType)=='undefined'||s.linkType=='e'){var"
+" v=s.c_r('s_ppv');s.c_w('s_ppv',0);return v;}");s.getPPVCalc=new Function("",""
+"var s=s_c_il["+s._in+"],sd=s.d,de=sd.documentElement,bo=sd.body,wd="
+"s.wd,sw=wd.document,wde=sw.documentElement,dh=Math.min(Math.max(bo."
+"scrollHeight,de.scrollHeight),Math.max(bo.offsetHeight,de.offsetHei"
+"ght),Math.max(bo.clientHeight,de.clientHeight)),vph=sd.innerHeight|"
+"|Math.min(de.clientHeight,bo.clientHeight),st=wd.pageYOffset||(wde."
+"scrollTop||sw.body.scrollTop),vh=st+vph,pv=Math.round(vh/dh*100),cv"
+"=s.c_r('s_ppv'),cpi=cv.indexOf('|'),cpv='',ps='';if(cpi!=-1){cpv=cv"
+".substring(0,cpi);ps=parseInt(cv.substring(cpi+1));}else{cpv=ps=0;}"
+"if(pv<=100){if(pv>parseInt(cpv)){ps=pv-Math.round(vph/dh*100);s.c_w"
+"('s_ppv',pv+'|'+ps);}}else{s.c_w('s_ppv','');}");s.getPPVSetup=new Function("",""
+"var s=this,wd=s.wd;if(wd.addEventListener){wd.addEventListener('loa"
+"d',s.getPPVCalc,false);wd.addEventListener('scroll',s.getPPVCalc,fa"
+"lse);wd.addEventListener('resize',s.getPPVCalc,false);}else if(wd.a"
+"ttachEvent){wd.attachEvent('onload',s.getPPVCalc);wd.attachEvent('o"
+"nscroll',s.getPPVCalc);wd.attachEvent('onresize',s.getPPVCalc);}");s.getPPVSetup();s.getNewRepeat=new Function("d",""
+"var s=this,e=new Date(),cval,sval,ct=e.getTime();e.setTime(ct+d*24*"
+"60*60*1000);cval=s.c_r('s_nr');if(cval.length==0){s.c_w('s_nr',ct+'"
+"-New',e);return 'New';}sval=cval.split('-');if(ct-sval[0]<30*60*100"
+"0&&sval[1]=='New'){s.c_w('s_nr',ct+'-New',e);return 'New';}else {s."
+"c_w('s_nr',ct+'-Repeat',e);return 'Repeat';}");s.vpr=new Function("vs","v","if(typeof(v)!='undefined'){var s=this; eval('s.'+vs+'=\"'+v+'\"')}");s.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x"
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a");s.repl=new Function("x","o","n",""
+"var i=x.indexOf(o),l=n.length;while(x&&i>=0){x=x.substring(0,i)+n+x."
+"substring(i+o.length);i=x.indexOf(o,i+l)}return x");s.apl=new Function("l","v","d","u",""
+"var s=this,m=0;if(!l)l='';if(u){var i,n,a=s.split(l,d);for(i=0;i<a."
+"length;i++){n=a[i];m=m||(u==1?(n==v):(n.toLowerCase()==v.toLowerCas"
+"e()));}}if(!m)l=l?l+d+v:v;return l");s.getDaysSinceLastVisit=new Function(""
+"var s=this,e=new Date(),cval,ct=e.getTime(),c='s_lastvisit',day=24*"
+"60*60*1000;e.setTime(ct+3*365*day);cval=s.c_r(c);if(!cval){s.c_w(c,"
+"ct,e);return 'First page view or cookies not supported';}else{var d"
+"=ct-cval;if(d>30*60*1000){if(d>30*day){s.c_w(c,ct,e);return 'More t"
+"han 30 days';}if(d<30*day+1 && d>7*day){s.c_w(c,ct,e);return 'More "
+"than 7 days';}if(d<7*day+1 && d>day){s.c_w(c,ct,e);return 'Less tha"
+"n 7 days';}if(d<day+1){s.c_w(c,ct,e);return 'Less than 1 day';}}els"
+"e return '';}");s.getTimeParting=new Function("t","z",""
+"var s=this,cy;var dc=new Date('1/1/2000');"
+"if(dc.getDay()!=6||dc.getMonth()!=0){return'Data Not Available'}"
+"else{;z=parseFloat(z);var dsts=new Date(s.dstStart);"
+"var dste=new Date(s.dstEnd);fl=dste;cd=new Date();if(cd>dsts&&cd<fl)"
+"{z=z+1}else{z=z};utc=cd.getTime()+(cd.getTimezoneOffset()*60000);"
+"tz=new Date(utc + (3600000*z));thisy=tz.getFullYear();"
+"var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',"
+"'Saturday'];if(thisy!=s.currentYear){return'Data Not Available'}else{;"
+"thish=tz.getHours();thismin=tz.getMinutes();thisd=tz.getDay();"
+"var dow=days[thisd];var ap='AM';var dt='Weekday';var mint='00';"
+"if(thismin>30){mint='30'}if(thish>=12){ap='PM';thish=thish-12};"
+"if (thish==0){thish=12};if(thisd==6||thisd==0){dt='Weekend'};"
+"var timestring=thish+':'+mint+ap;if(t=='h'){return timestring}"
+"if(t=='d'){return dow};if(t=='w'){return dt}}};");s.getQueryParam=new Function("p","d","u",""
+"var s=this,v='',i,t;d=d?d:'';u=u?u:(s.pageURL?s.pageURL:s.wd.locati"
+"on);if(u=='f')u=s.gtfs().location;while(p){i=p.indexOf(',');i=i<0?p"
+".length:i;t=s.p_gpv(p.substring(0,i),u+'');if(t){t=t.indexOf('#')>-"
+"1?t.substring(0,t.indexOf('#')):t;}if(t)v+=v?d+t:t;p=p.substring(i="
+"=p.length?i:i+1)}return v");s.p_gpv=new Function("k","u",""
+"var s=this,v='',i=u.indexOf('?'),q;if(k&&i>-1){q=u.substring(i+1);v"
+"=s.pt(q,'&','p_gvf',k)}return v");s.p_gvf=new Function("t","k",""
+"if(t){var s=this,i=t.indexOf('='),p=i<0?t:t.substring(0,i),v=i<0?'T"
+"rue':t.substring(i+1);if(p.toLowerCase()==k.toLowerCase())return s."
+"epa(v)}return ''");s.getValOnce=new Function("v","c","e",""
+"var s=this,v=v?v:'',k=s.c_r(c),a=new Date,e=e?e:0;if(v){a.setTime(a"
+".getTime()+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");s.setupFormAnalysis=new Function(""
+"var s=this;if(!s.fa){s.fa=new Object;var f=s.fa;f.ol=s.wd.onload;s."
+"wd.onload=s.faol;f.uc=s.useCommerce;f.vu=s.varUsed;f.vl=f.uc?s.even"
+"tList:'';f.tfl=s.trackFormList;f.fl=s.formList;f.va=new Array('',''"
+",'','')}");s.sendFormEvent=new Function("t","pn","fn","en",""
+"var s=this,f=s.fa;t=t=='s'?t:'e';f.va[0]=pn;f.va[1]=fn;f.va[3]=t=='"
+"s'?'Success':en;s.fasl(t);f.va[1]='';f.va[3]='';");s.faol=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,r=true,fo,fn,i,en,t,tf;if(!e)e=s.wd."
+"event;f.os=new Array;if(f.ol)r=f.ol(e);if(s.d.forms&&s.d.forms.leng"
+"th>0){for(i=s.d.forms.length-1;i>=0;i--){fo=s.d.forms[i];fn=fo.name"
+";tf=f.tfl&&s.pt(f.fl,',','ee',fn)||!f.tfl&&!s.pt(f.fl,',','ee',fn);"
+"if(tf){f.os[fn]=fo.onsubmit;fo.onsubmit=s.faos;f.va[1]=fn;f.va[3]='"
+"No Data Entered';for(en=0;en<fo.elements.length;en++){el=fo.element"
+"s[en];t=el.type;if(t&&t.toUpperCase){t=t.toUpperCase();var md=el.on"
+"mousedown,kd=el.onkeydown,omd=md?md.toString():'',okd=kd?kd.toStrin"
+"g():'';if(omd.indexOf('.fam(')<0&&okd.indexOf('.fam(')<0){el.s_famd"
+"=md;el.s_fakd=kd;el.onmousedown=s.fam;el.onkeydown=s.fam}}}}}f.ul=s"
+".wd.onunload;s.wd.onunload=s.fasl;}return r;");s.faos=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,su;if(!e)e=s.wd.event;if(f.vu){s[f.v"
+"u]='';f.va[1]='';f.va[3]='';}su=f.os[this.name];return su?su(e):tru"
+"e;");s.fasl=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa,a=f.va,l=s.wd.location,ip=s.trackPag"
+"eName,p=s.pageName;if(a[1]!=''&&a[3]!=''){a[0]=!p&&ip?l.host+l.path"
+"name:a[0]?a[0]:p;if(!f.uc&&a[3]!='No Data Entered'){if(e=='e')a[2]="
+"'Error';else if(e=='s')a[2]='Success';else a[2]='Abandon'}else a[2]"
+"='';var tp=ip?a[0]+':':'',t3=e!='s'?':('+a[3]+')':'',ym=!f.uc&&a[3]"
+"!='No Data Entered'?tp+a[1]+':'+a[2]+t3:tp+a[1]+t3,ltv=s.linkTrackV"
+"ars,lte=s.linkTrackEvents,up=s.usePlugins;if(f.uc){s.linkTrackVars="
+"ltv=='None'?f.vu+',events':ltv+',events,'+f.vu;s.linkTrackEvents=lt"
+"e=='None'?f.vl:lte+','+f.vl;f.cnt=-1;if(e=='e')s.events=s.pt(f.vl,'"
+",','fage',2);else if(e=='s')s.events=s.pt(f.vl,',','fage',1);else s"
+".events=s.pt(f.vl,',','fage',0)}else{s.linkTrackVars=ltv=='None'?f."
+"vu:ltv+','+f.vu}s[f.vu]=ym;s.usePlugins=false;s.tl(true,'o','Form A"
+"nalysis');s[f.vu]='';s.usePlugins=up}return f.ul&&e!='e'&&e!='s'?f."
+"ul(e):true;");s.fam=new Function("e",""
+"var s=s_c_il["+s._in+"],f=s.fa;if(!e) e=s.wd.event;var o=s.trackLas"
+"tChanged,et=e.type.toUpperCase(),t=this.type.toUpperCase(),fn=this."
+"form.name,en=this.name,sc=false;if(document.layers){kp=e.which;b=e."
+"which}else{kp=e.keyCode;b=e.button}et=et=='MOUSEDOWN'?1:et=='KEYDOW"
+"N'?2:et;if(f.ce!=en||f.cf!=fn){if(et==1&&b!=2&&'BUTTONSUBMITRESETIM"
+"AGERADIOCHECKBOXSELECT-ONEFILE'.indexOf(t)>-1){f.va[1]=fn;f.va[3]=e"
+"n;sc=true}else if(et==1&&b==2&&'TEXTAREAPASSWORDFILE'.indexOf(t)>-1"
+"){f.va[1]=fn;f.va[3]=en;sc=true}else if(et==2&&kp!=9&&kp!=13){f.va["
+"1]=fn;f.va[3]=en;sc=true}if(sc){nface=en;nfacf=fn}}if(et==1&&this.s"
+"_famd)return this.s_famd(e);if(et==2&&this.s_fakd)return this.s_fak"
+"d(e);");s.ee=new Function("e","n",""
+"return n&&n.toLowerCase?e.toLowerCase()==n.toLowerCase():false;");s.fage=new Function("e","a",""
+"var s=this,f=s.fa,x=f.cnt;x=x?x+1:1;f.cnt=x;return x==a?e:'';");s.getImgLength=new Function(""
+"var s=this;if(navigator.appName.indexOf('Microsoft Internet Explorer"
+"')!=-1){if(window['s_i_'+s.visitorNamespace]!=null){var oImg=window["
+"'s_i_'+s.visitorNamespace],arrSrc,newReq='',newImg,oBody;if(oImg!=nu"
+"ll){if(oImg.src.length>=2083){arrSrc=s.split(oImg.src,'&');for(var i"
+"=0;i<arrSrc.length;i++){if(arrSrc[i].length>2){if(arrSrc[i].substrin"
+"g(0,2)=='r=')arrSrc[i]='r=stripped off';}}newSrc=arrSrc.join('&');oB"
+"ody=document.getElementsByTagName('body')[0];newImg=document.createE"
+"lement('IMG');newImg.src=newSrc;oBody.appendChild(newImg);}}}}");var title=document.title;var referrer,location;if(($("#webAnalytics")==="undefined")&&(title!=="Analytics")){referrer=document.referrer;location=location.href;}else{try{referrer=window.parent.referrer;location=window.parent.location;}catch(err){referrer="undefined";location="undefined";}
if(referrer!=="undefined"){s.referrer=referrer;}
if(location!=="undefined"){s.pageURL=location;}}
s.pageName=ct1.WebAnalyticsService.cleanData(data.pageName);s.server=ct1.WebAnalyticsService.cleanData(data.serverName);s.channel=ct1.WebAnalyticsService.cleanData(data.siteSection);s.pageType=ct1.WebAnalyticsService.cleanData(data.pageType);s.products=data.products;s.prop1=ct1.WebAnalyticsService.cleanData(data.subSection);s.prop2=ct1.WebAnalyticsService.cleanData(data.subSection2);s.prop3=ct1.WebAnalyticsService.cleanData(data.subSection3);s.prop4=ct1.WebAnalyticsService.cleanData(data.subSection4);s.prop5=ct1.WebAnalyticsService.cleanData(data.contentType);s.prop6=ct1.WebAnalyticsService.cleanData(data.contentTitle);s.prop7=data.contentID;s.prop8=ct1.WebAnalyticsService.cleanData(data.keywords);s.prop12=ct1.WebAnalyticsService.cleanData(data.searchResults);s.prop13=ct1.WebAnalyticsService.cleanData(data.searchDimensions);s.prop69=ct1.WebAnalyticsService.cleanData(data.multiSelect);s.prop14=ct1.WebAnalyticsService.cleanData(data.radius);s.prop16=ct1.WebAnalyticsService.cleanData(data.make);s.prop17=ct1.WebAnalyticsService.cleanData(data.model);s.prop18=ct1.WebAnalyticsService.cleanData(data.minPrice);s.prop19=ct1.WebAnalyticsService.cleanData(data.maxPrice);s.prop20=ct1.WebAnalyticsService.cleanData(data.mileage);s.prop21=ct1.WebAnalyticsService.cleanData(data.age);s.prop22=ct1.WebAnalyticsService.cleanData(data.usedOrNew);s.prop23=ct1.WebAnalyticsService.cleanData(data.searchOrder);s.prop24=ct1.WebAnalyticsService.cleanData(data.searchSeller);s.prop32=ct1.WebAnalyticsService.cleanData(data.sellerType);s.prop40=ct1.WebAnalyticsService.cleanData(data.vehicleDescription);s.prop42=ct1.WebAnalyticsService.cleanData(data.fpaAdvertPrice);s.prop45=ct1.WebAnalyticsService.cleanData(data.transmissionTypes);s.prop48=ct1.WebAnalyticsService.cleanData(data.olaAdvertPrice);s.prop49=ct1.WebAnalyticsService.cleanData(data.packageSelected);s.prop50=ct1.WebAnalyticsService.cleanData(data.formErrors);s.prop57=ct1.WebAnalyticsService.cleanData(data.leisureTypes);s.prop58=ct1.WebAnalyticsService.cleanData(data.bodyTypes);s.prop63=ct1.WebAnalyticsService.cleanData(data.engineCapacities);s.prop64=ct1.WebAnalyticsService.cleanData(data.watchlistAdvertCount);s.prop66=ct1.WebAnalyticsService.cleanData(data.fuelTypes);s.prop67=ct1.WebAnalyticsService.cleanData(data.featuredListingId);s.prop68=ct1.WebAnalyticsService.cleanData(data.userLocation);s.prop70=ct1.WebAnalyticsService.cleanData(data.multiSelectValues);s.prop71=ct1.WebAnalyticsService.cleanData(data.magShortCode);s.prop75=ct1.WebAnalyticsService.cleanData(data.orderRef);s.purchaseid=s.prop75;s.eVar23=ct1.WebAnalyticsService.cleanData(data.productID);if(data.events){s.events=data.events;}else if(data.postcode!==undefined){if(data.isUniqueSearch){s.events="event1,event12";}else{s.events="event12";}}
s.hier1=ct1.WebAnalyticsService.cleanData(data.hierarchy);s.prop29=data.loggedInUser?data.loggedInUser.toString().toLowerCase():"no";s.prop30=data.userId;s.prop31=ct1.WebAnalyticsService.cleanData(data.siteVersion);s.prop39=ct1.WebAnalyticsService.cleanData(data.noOfPhotos);s.prop28=s.getPreviousValue(s.pageName,"s_pv");if(s.prop28){s.prop27=s.getPercentPageViewed();}
var s_code=s.t();s.getImgLength();if(s_code){document.write(s_code);}};ct1.WebAnalyticsService.clearOmnitureObject=function(sObj){for(var i=0;i<100;i++){sObj['prop'+i]='';sObj['eVar'+i]='';}
sObj.products='';sObj.events='';sObj.linkTrackVars='';sObj.server='';sObj.channel='';sObj.pageName='';sObj.pageType='';sObj.campaign='';};var s_code='',s_objectID;function s_gi(un,pg,ss){var c="s.version='H.23.3';s.an=s_an;s.logDebug=function(m){var s=this,tcf=new Function('var e;try{console.log(\"'+s.rep(s.rep(m,\"\\n\",\"\\\\n\"),\""
+"\\\"\",\"\\\\\\\"\")+'\");}catch(e){}');tcf()};s.cls=function(x,c){var i,y='';if(!c)c=this.an;for(i=0;i<x.length;i++){n=x.substring(i,i+1);if(c.indexOf(n)>=0)y+=n}return y};s.fl=function(x,l){retur"
+"n x?(''+x).substring(0,l):x};s.co=function(o){if(!o)return o;var n=new Object,x;for(x in o)if(x.indexOf('select')<0&&x.indexOf('filter')<0)n[x]=o[x];return n};s.num=function(x){x=''+x;for(var p=0;p"
+"<x.length;p++)if(('0123456789').indexOf(x.substring(p,p+1))<0)return 0;return 1};s.rep=s_rep;s.sp=s_sp;s.jn=s_jn;s.ape=function(x){var s=this,h='0123456789ABCDEF',i,c=s.charSet,n,l,e,y='';c=c?c.toU"
+"pperCase():'';if(x){x=''+x;if(s.em==3)x=encodeURIComponent(x);else if(c=='AUTO'&&('').charCodeAt){for(i=0;i<x.length;i++){c=x.substring(i,i+1);n=x.charCodeAt(i);if(n>127){l=0;e='';while(n||l<4){e=h"
+".substring(n%16,n%16+1)+e;n=(n-n%16)/16;l++}y+='%u'+e}else if(c=='+')y+='%2B';else y+=escape(c)}x=y}else x=escape(''+x);x=s.rep(x,'+','%2B');if(c&&c!='AUTO'&&s.em==1&&x.indexOf('%u')<0&&x.indexOf('"
+"%U')<0){i=x.indexOf('%');while(i>=0){i++;if(h.substring(8).indexOf(x.substring(i,i+1).toUpperCase())>=0)return x.substring(0,i)+'u00'+x.substring(i);i=x.indexOf('%',i)}}}return x};s.epa=function(x)"
+"{var s=this;if(x){x=s.rep(''+x,'+',' ');return s.em==3?decodeURIComponent(x):unescape(x)}return x};s.pt=function(x,d,f,a){var s=this,t=x,z=0,y,r;while(t){y=t.indexOf(d);y=y<0?t.length:y;t=t.substri"
+"ng(0,y);r=s[f](t,a);if(r)return r;z+=y+d.length;t=x.substring(z,x.length);t=z<x.length?t:''}return ''};s.isf=function(t,a){var c=a.indexOf(':');if(c>=0)a=a.substring(0,c);c=a.indexOf('=');if(c>=0)a"
+"=a.substring(0,c);if(t.substring(0,2)=='s_')t=t.substring(2);return (t!=''&&t==a)};s.fsf=function(t,a){var s=this;if(s.pt(a,',','isf',t))s.fsg+=(s.fsg!=''?',':'')+t;return 0};s.fs=function(x,f){var"
+" s=this;s.fsg='';s.pt(x,',','fsf',f);return s.fsg};s.si=function(){var s=this,i,k,v,c=s_gi+'var s=s_gi(\"'+s.oun+'\");s.sa(\"'+s.un+'\");';for(i=0;i<s.va_g.length;i++){k=s.va_g[i];v=s[k];if(v!=unde"
+"fined){if(typeof(v)!='number')c+='s.'+k+'=\"'+s_fe(v)+'\";';else c+='s.'+k+'='+v+';'}}c+=\"s.lnk=s.eo=s.linkName=s.linkType=s.wd.s_objectID=s.ppu=s.pe=s.pev1=s.pev2=s.pev3='';\";return c};s.c_d='';"
+"s.c_gdf=function(t,a){var s=this;if(!s.num(t))return 1;return 0};s.c_gd=function(){var s=this,d=s.wd.location.hostname,n=s.fpCookieDomainPeriods,p;if(!n)n=s.cookieDomainPeriods;if(d&&!s.c_d){n=n?pa"
+"rseInt(n):2;n=n>2?n:2;p=d.lastIndexOf('.');if(p>=0){while(p>=0&&n>1){p=d.lastIndexOf('.',p-1);n--}s.c_d=p>0&&s.pt(d,'.','c_gdf',0)?d.substring(p):d}}return s.c_d};s.c_r=function(k){var s=this;k=s.a"
+"pe(k);var c=' '+s.d.cookie,i=c.indexOf(' '+k+'='),e=i<0?i:c.indexOf(';',i),v=i<0?'':s.epa(c.substring(i+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''};s.c_w=function(k,v,e){var s=this,d=s.c_gd"
+"(),l=s.cookieLifetime,t;v=''+v;l=l?(''+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){t=(v!=''?parseInt(l?l:0):-60);if(t){e=new Date;e.setTime(e.getTime()+(t*1000))}}if(k&&l!='NONE'){s.d.cookie"
+"=k+'='+s.ape(v!=''?v:'[[B]]')+'; path=/;'+(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?' domain='+d+';':'');return s.c_r(k)==v}return 0};s.eh=function(o,e,r,f){var s=this,b='s_'+e+'_'+s."
+"_in,n=-1,l,i,x;if(!s.ehl)s.ehl=new Array;l=s.ehl;for(i=0;i<l.length&&n<0;i++){if(l[i].o==o&&l[i].e==e)n=i}if(n<0){n=i;l[n]=new Object}x=l[n];x.o=o;x.e=e;f=r?x.b:f;if(r||f){x.b=r?0:o[e];x.o[e]=f}if("
+"x.b){x.o[b]=x.b;return b}return 0};s.cet=function(f,a,t,o,b){var s=this,r,tcf;if(s.apv>=5&&(!s.isopera||s.apv>=7)){tcf=new Function('s','f','a','t','var e,r;try{r=s[f](a)}catch(e){r=s[t](e)}return "
+"r');r=tcf(s,f,a,t)}else{if(s.ismac&&s.u.indexOf('MSIE 4')>=0)r=s[b](a);else{s.eh(s.wd,'onerror',0,o);r=s[f](a);s.eh(s.wd,'onerror',1)}}return r};s.gtfset=function(e){var s=this;return s.tfs};s.gtfs"
+"oe=new Function('e','var s=s_c_il['+s._in+'],c;s.eh(window,\"onerror\",1);s.etfs=1;c=s.t();if(c)s.d.write(c);s.etfs=0;return true');s.gtfsfb=function(a){return window};s.gtfsf=function(w){var s=thi"
+"s,p=w.parent,l=w.location;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.host){s.tfs=p;return s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){var s=this;if(!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet"
+"('gtfsf',s.tfs,'gtfset',s.gtfsoe,'gtfsfb')}return s.tfs};s.mrq=function(u){var s=this,l=s.rl[u],n,r;s.rl[u]=0;if(l)for(n=0;n<l.length;n++){r=l[n];s.mr(0,0,r.r,r.t,r.u)}};s.flushBufferedRequests=fun"
+"ction(){};s.mr=function(sess,q,rs,ta,u){var s=this,dc=s.dc,t1=s.trackingServer,t2=s.trackingServerSecure,tb=s.trackingServerBase,p='.sc',ns=s.visitorNamespace,un=s.cls(u?u:(ns?ns:s.fun)),r=new Obje"
+"ct,l,imn='s_i_'+(un),im,b,e;if(!rs){if(t1){if(t2&&s.ssl)t1=t2}else{if(!tb)tb='2o7.net';if(dc)dc=(''+dc).toLowerCase();else dc='d1';if(tb=='2o7.net'){if(dc=='d1')dc='112';else if(dc=='d2')dc='122';p"
+"=''}t1=un+'.'+dc+'.'+p+tb}rs='http'+(s.ssl?'s':'')+'://'+t1+'/b/ss/'+s.un+'/'+(s.mobile?'5.1':'1')+'/'+s.version+'/'+sess+'?AQB=1&ndh=1'+(q?q:'')+'&AQE=1';if(s.isie&&!s.ismac)rs=s.fl(rs,2047)}if(s."
+"d.images&&s.apv>=3&&(!s.isopera||s.apv>=7)&&(s.ns6<0||s.apv>=6.1)){if(!s.rc)s.rc=new Object;if(!s.rc[un]){s.rc[un]=1;if(!s.rl)s.rl=new Object;s.rl[un]=new Array;setTimeout('if(window.s_c_il)window."
+"s_c_il['+s._in+'].mrq(\"'+un+'\")',750)}else{l=s.rl[un];if(l){r.t=ta;r.u=un;r.r=rs;l[l.length]=r;return ''}imn+='_'+s.rc[un];s.rc[un]++}im=s.wd[imn];if(!im)im=s.wd[imn]=new Image;im.s_l=0;im.onload"
+"=new Function('e','this.s_l=1;var wd=window,s;if(wd.s_c_il){s=wd.s_c_il['+s._in+'];s.mrq(\"'+un+'\");s.nrs--;if(!s.nrs)s.m_m(\"rr\")}');if(!s.nrs){s.nrs=1;s.m_m('rs')}else s.nrs++;if(s.debugTrackin"
+"g){var d='AppMeasurement Debug: '+rs,dl=s.sp(rs,'&'),dln;for(dln=0;dln<dl.length;dln++)d+=\"\\n\\t\"+s.epa(dl[dln]);s.logDebug(d)}im.src=rs;if((!ta||ta=='_self'||ta=='_top'||(s.wd.name&&ta==s.wd.na"
+"me))&&rs.indexOf('&pe=')>=0){b=e=new Date;while(!im.s_l&&e.getTime()-b.getTime()<500)e=new Date}return ''}return '<im'+'g sr'+'c=\"'+rs+'\" width=1 height=1 border=0 alt=\"\">'};s.gg=function(v){va"
+"r s=this;if(!s.wd['s_'+v])s.wd['s_'+v]='';return s.wd['s_'+v]};s.glf=function(t,a){if(t.substring(0,2)=='s_')t=t.substring(2);var s=this,v=s.gg(t);if(v)s[t]=v};s.gl=function(v){var s=this;if(s.pg)s"
+".pt(v,',','glf',0)};s.rf=function(x){var s=this,y,i,j,h,p,l=0,q,a,b='',c='',t;if(x&&x.length>255){y=''+x;i=y.indexOf('?');if(i>0){q=y.substring(i+1);y=y.substring(0,i);h=y.toLowerCase();j=0;if(h.su"
+"bstring(0,7)=='http://')j+=7;else if(h.substring(0,8)=='https://')j+=8;i=h.indexOf(\"/\",j);if(i>0){h=h.substring(j,i);p=y.substring(i);y=y.substring(0,i);if(h.indexOf('google')>=0)l=',q,ie,start,s"
+"earch_key,word,kw,cd,';else if(h.indexOf('yahoo.co')>=0)l=',p,ei,';if(l&&q){a=s.sp(q,'&');if(a&&a.length>1){for(j=0;j<a.length;j++){t=a[j];i=t.indexOf('=');if(i>0&&l.indexOf(','+t.substring(0,i)+',"
+"')>=0)b+=(b?'&':'')+t;else c+=(c?'&':'')+t}if(b&&c)q=b+'&'+c;else c=''}i=253-(q.length-c.length)-y.length;x=y+(i>0?p.substring(0,i):'')+'?'+q}}}}return x};s.s2q=function(k,v,vf,vfp,f){var s=this,qs"
+"='',sk,sv,sp,ss,nke,nk,nf,nfl=0,nfn,nfm;if(k==\"contextData\")k=\"c\";if(v){for(sk in v) {if((!f||sk.substring(0,f.length)==f)&&v[sk]&&(!vf||vf.indexOf(','+(vfp?vfp+'.':'')+sk+',')>=0)){nfm=0;if(nf"
+"l)for(nfn=0;nfn<nfl.length;nfn++)if(sk.substring(0,nfl[nfn].length)==nfl[nfn])nfm=1;if(!nfm){if(qs=='')qs+='&'+k+'.';sv=v[sk];if(f)sk=sk.substring(f.length);if(sk.length>0){nke=sk.indexOf('.');if(n"
+"ke>0){nk=sk.substring(0,nke);nf=(f?f:'')+nk+'.';if(!nfl)nfl=new Array;nfl[nfl.length]=nf;qs+=s.s2q(nk,v,vf,vfp,nf)}else{if(typeof(sv)=='boolean'){if(sv)sv='true';else sv='false'}if(sv){if(vfp=='ret"
+"rieveLightData'&&f.indexOf('.contextData.')<0){sp=sk.substring(0,4);ss=sk.substring(4);if(sk=='transactionID')sk='xact';else if(sk=='channel')sk='ch';else if(sk=='campaign')sk='v0';else if(s.num(ss"
+")){if(sp=='prop')sk='c'+ss;else if(sp=='eVar')sk='v'+ss;else if(sp=='list')sk='l'+ss;else if(sp=='hier'){sk='h'+ss;sv=sv.substring(0,255)}}}qs+='&'+s.ape(sk)+'='+s.ape(sv)}}}}}}if(qs!='')qs+='&.'+k"
+"}return qs};s.hav=function(){var s=this,qs='',l,fv='',fe='',mn,i,e;if(s.lightProfileID){l=s.va_m;fv=s.lightTrackVars;if(fv)fv=','+fv+','+s.vl_mr+','}else{l=s.va_t;if(s.pe||s.linkType){fv=s.linkTrac"
+"kVars;fe=s.linkTrackEvents;if(s.pe){mn=s.pe.substring(0,1).toUpperCase()+s.pe.substring(1);if(s[mn]){fv=s[mn].trackVars;fe=s[mn].trackEvents}}}if(fv)fv=','+fv+','+s.vl_l+','+s.vl_l2;if(fe){fe=','+f"
+"e+',';if(fv)fv+=',events,'}if (s.events2)e=(e?',':'')+s.events2}for(i=0;i<l.length;i++){var k=l[i],v=s[k],b=k.substring(0,4),x=k.substring(4),n=parseInt(x),q=k;if(!v)if(k=='events'&&e){v=e;e=''}if("
+"v&&(!fv||fv.indexOf(k)>=0)&&k!='linkName'&&k!='linkType'){if(k=='timestamp')q='ts';else if(k=='dynamicVariablePrefix')q='D';else if(k=='visitorID')q='vid';else if(k=='pageURL'){q='g';v=s.fl(v,255)}"
+"else if(k=='referrer'){q='r';v=s.fl(s.rf(v),255)}else if(k=='vmk'||k=='visitorMigrationKey')q='vmt';else if(k=='visitorMigrationServer'){q='vmf';if(s.ssl&&s.visitorMigrationServerSecure)v=''}else i"
+"f(k=='visitorMigrationServerSecure'){q='vmf';if(!s.ssl&&s.visitorMigrationServer)v=''}else if(k=='charSet'){q='ce';if(v.toUpperCase()=='AUTO')v='ISO8859-1';else if(s.em==2||s.em==3)v='UTF-8'}else i"
+"f(k=='visitorNamespace')q='ns';else if(k=='cookieDomainPeriods')q='cdp';else if(k=='cookieLifetime')q='cl';else if(k=='variableProvider')q='vvp';else if(k=='currencyCode')q='cc';else if(k=='channel"
+"')q='ch';else if(k=='transactionID')q='xact';else if(k=='campaign')q='v0';else if(k=='resolution')q='s';else if(k=='colorDepth')q='c';else if(k=='javascriptVersion')q='j';else if(k=='javaEnabled')q"
+"='v';else if(k=='cookiesEnabled')q='k';else if(k=='browserWidth')q='bw';else if(k=='browserHeight')q='bh';else if(k=='connectionType')q='ct';else if(k=='homepage')q='hp';else if(k=='plugins')q='p';"
+"else if(k=='events'){if(e)v+=(v?',':'')+e;if(fe)v=s.fs(v,fe)}else if(k=='events2')v='';else if(k=='contextData'){qs+=s.s2q('c',s[k],fv,k,0);v=''}else if(k=='lightProfileID')q='mtp';else if(k=='ligh"
+"tStoreForSeconds'){q='mtss';if(!s.lightProfileID)v=''}else if(k=='lightIncrementBy'){q='mti';if(!s.lightProfileID)v=''}else if(k=='retrieveLightProfiles')q='mtsr';else if(k=='deleteLightProfiles')q"
+"='mtsd';else if(k=='retrieveLightData'){if(s.retrieveLightProfiles)qs+=s.s2q('mts',s[k],fv,k,0);v=''}else if(s.num(x)){if(b=='prop')q='c'+n;else if(b=='eVar')q='v'+n;else if(b=='list')q='l'+n;else "
+"if(b=='hier'){q='h'+n;v=s.fl(v,255)}}if(v)qs+='&'+s.ape(q)+'='+(k.substring(0,3)!='pev'?s.ape(v):v)}}return qs};s.ltdf=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';var qi=h.indexOf('"
+"?');h=qi>=0?h.substring(0,qi):h;if(t&&h.substring(h.length-(t.length+1))=='.'+t)return 1;return 0};s.ltef=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';if(t&&h.indexOf(t)>=0)return 1;"
+"return 0};s.lt=function(h){var s=this,lft=s.linkDownloadFileTypes,lef=s.linkExternalFilters,lif=s.linkInternalFilters;lif=lif?lif:s.wd.location.hostname;h=h.toLowerCase();if(s.trackDownloadLinks&&l"
+"ft&&s.pt(lft,',','ltdf',h))return 'd';if(s.trackExternalLinks&&h.substring(0,1)!='#'&&(lef||lif)&&(!lef||s.pt(lef,',','ltef',h))&&(!lif||!s.pt(lif,',','ltef',h)))return 'e';return ''};s.lc=new Func"
+"tion('e','var s=s_c_il['+s._in+'],b=s.eh(this,\"onclick\");s.lnk=s.co(this);s.t();s.lnk=0;if(b)return this[b](e);return true');s.bc=new Function('e','var s=s_c_il['+s._in+'],f,tcf;if(s.d&&s.d.all&&"
+"s.d.all.cppXYctnr)return;s.eo=e.srcElement?e.srcElement:e.target;tcf=new Function(\"s\",\"var e;try{if(s.eo&&(s.eo.tagName||s.eo.parentElement||s.eo.parentNode))s.t()}catch(e){}\");tcf(s);s.eo=0');"
+"s.oh=function(o){var s=this,l=s.wd.location,h=o.href?o.href:'',i,j,k,p;i=h.indexOf(':');j=h.indexOf('?');k=h.indexOf('/');if(h&&(i<0||(j>=0&&i>j)||(k>=0&&i>k))){p=o.protocol&&o.protocol.length>1?o."
+"protocol:(l.protocol?l.protocol:'');i=l.pathname.lastIndexOf('/');h=(p?p+'//':'')+(o.host?o.host:(l.host?l.host:''))+(h.substring(0,1)!='/'?l.pathname.substring(0,i<0?0:i)+'/':'')+h}return h};s.ot="
+"function(o){var t=o.tagName;if(o.tagUrn||(o.scopeName&&o.scopeName.toUpperCase()!='HTML'))return '';t=t&&t.toUpperCase?t.toUpperCase():'';if(t=='SHAPE')t='';if(t){if((t=='INPUT'||t=='BUTTON')&&o.ty"
+"pe&&o.type.toUpperCase)t=o.type.toUpperCase();else if(!t&&o.href)t='A';}return t};s.oid=function(o){var s=this,t=s.ot(o),p,c,n='',x=0;if(t&&!o.s_oid){p=o.protocol;c=o.onclick;if(o.href&&(t=='A'||t="
+"='AREA')&&(!c||!p||p.toLowerCase().indexOf('javascript')<0))n=s.oh(o);else if(c){n=s.rep(s.rep(s.rep(s.rep(''+c,\"\\r\",''),\"\\n\",''),\"\\t\",''),' ','');x=2}else if(t=='INPUT'||t=='SUBMIT'){if(o"
+".value)n=o.value;else if(o.innerText)n=o.innerText;else if(o.textContent)n=o.textContent;x=3}else if(o.src&&t=='IMAGE')n=o.src;if(n){o.s_oid=s.fl(n,100);o.s_oidt=x}}return o.s_oid};s.rqf=function(t"
+",un){var s=this,e=t.indexOf('='),u=e>=0?t.substring(0,e):'',q=e>=0?s.epa(t.substring(e+1)):'';if(u&&q&&(','+u+',').indexOf(','+un+',')>=0){if(u!=s.un&&s.un.indexOf(',')>=0)q='&u='+u+q+'&u=0';return"
+" q}return ''};s.rq=function(un){if(!un)un=this.un;var s=this,c=un.indexOf(','),v=s.c_r('s_sq'),q='';if(c<0)return s.pt(v,'&','rqf',un);return s.pt(un,',','rq',0)};s.sqp=function(t,a){var s=this,e=t"
+".indexOf('='),q=e<0?'':s.epa(t.substring(e+1));s.sqq[q]='';if(e>=0)s.pt(t.substring(0,e),',','sqs',q);return 0};s.sqs=function(un,q){var s=this;s.squ[un]=q;return 0};s.sq=function(q){var s=this,k='"
+"s_sq',v=s.c_r(k),x,c=0;s.sqq=new Object;s.squ=new Object;s.sqq[q]='';s.pt(v,'&','sqp',0);s.pt(s.un,',','sqs',q);v='';for(x in s.squ)if(x&&(!Object||!Object.prototype||!Object.prototype[x]))s.sqq[s."
+"squ[x]]+=(s.sqq[s.squ[x]]?',':'')+x;for(x in s.sqq)if(x&&(!Object||!Object.prototype||!Object.prototype[x])&&s.sqq[x]&&(x==q||c<2)){v+=(v?'&':'')+s.sqq[x]+'='+s.ape(x);c++}return s.c_w(k,v,0)};s.wd"
+"l=new Function('e','var s=s_c_il['+s._in+'],r=true,b=s.eh(s.wd,\"onload\"),i,o,oc;if(b)r=this[b](e);for(i=0;i<s.d.links.length;i++){o=s.d.links[i];oc=o.onclick?\"\"+o.onclick:\"\";if((oc.indexOf(\""
+"s_gs(\")<0||oc.indexOf(\".s_oc(\")>=0)&&oc.indexOf(\".tl(\")<0)s.eh(o,\"onclick\",0,s.lc);}return r');s.wds=function(){var s=this;if(s.apv>3&&(!s.isie||!s.ismac||s.apv>=5)){if(s.b&&s.b.attachEvent)"
+"s.b.attachEvent('onclick',s.bc);else if(s.b&&s.b.addEventListener)s.b.addEventListener('click',s.bc,false);else s.eh(s.wd,'onload',0,s.wdl)}};s.vs=function(x){var s=this,v=s.visitorSampling,g=s.vis"
+"itorSamplingGroup,k='s_vsn_'+s.un+(g?'_'+g:''),n=s.c_r(k),e=new Date,y=e.getYear();e.setYear(y+10+(y<1900?1900:0));if(v){v*=100;if(!n){if(!s.c_w(k,x,e))return 0;n=x}if(n%10000>v)return 0}return 1};"
+"s.dyasmf=function(t,m){if(t&&m&&m.indexOf(t)>=0)return 1;return 0};s.dyasf=function(t,m){var s=this,i=t?t.indexOf('='):-1,n,x;if(i>=0&&m){var n=t.substring(0,i),x=t.substring(i+1);if(s.pt(x,',','dy"
+"asmf',m))return n}return 0};s.uns=function(){var s=this,x=s.dynamicAccountSelection,l=s.dynamicAccountList,m=s.dynamicAccountMatch,n,i;s.un=s.un.toLowerCase();if(x&&l){if(!m)m=s.wd.location.host;if"
+"(!m.toLowerCase)m=''+m;l=l.toLowerCase();m=m.toLowerCase();n=s.pt(l,';','dyasf',m);if(n)s.un=n}i=s.un.indexOf(',');s.fun=i<0?s.un:s.un.substring(0,i)};s.sa=function(un){var s=this;s.un=un;if(!s.oun"
+")s.oun=un;else if((','+s.oun+',').indexOf(','+un+',')<0)s.oun+=','+un;s.uns()};s.m_i=function(n,a){var s=this,m,f=n.substring(0,1),r,l,i;if(!s.m_l)s.m_l=new Object;if(!s.m_nl)s.m_nl=new Array;m=s.m"
+"_l[n];if(!a&&m&&m._e&&!m._i)s.m_a(n);if(!m){m=new Object,m._c='s_m';m._in=s.wd.s_c_in;m._il=s._il;m._il[m._in]=m;s.wd.s_c_in++;m.s=s;m._n=n;m._l=new Array('_c','_in','_il','_i','_e','_d','_dl','s',"
+"'n','_r','_g','_g1','_t','_t1','_x','_x1','_rs','_rr','_l');s.m_l[n]=m;s.m_nl[s.m_nl.length]=n}else if(m._r&&!m._m){r=m._r;r._m=m;l=m._l;for(i=0;i<l.length;i++)if(m[l[i]])r[l[i]]=m[l[i]];r._il[r._i"
+"n]=r;m=s.m_l[n]=r}if(f==f.toUpperCase())s[n]=m;return m};s.m_a=new Function('n','g','e','if(!g)g=\"m_\"+n;var s=s_c_il['+s._in+'],c=s[g+\"_c\"],m,x,f=0;if(!c)c=s.wd[\"s_\"+g+\"_c\"];if(c&&s_d)s[g]="
+"new Function(\"s\",s_ft(s_d(c)));x=s[g];if(!x)x=s.wd[\\'s_\\'+g];if(!x)x=s.wd[g];m=s.m_i(n,1);if(x&&(!m._i||g!=\"m_\"+n)){m._i=f=1;if((\"\"+x).indexOf(\"function\")>=0)x(s);else s.m_m(\"x\",n,x,e)}"
+"m=s.m_i(n,1);if(m._dl)m._dl=m._d=0;s.dlt();return f');s.m_m=function(t,n,d,e){t='_'+t;var s=this,i,x,m,f='_'+t,r=0,u;if(s.m_l&&s.m_nl)for(i=0;i<s.m_nl.length;i++){x=s.m_nl[i];if(!n||x==n){m=s.m_i(x"
+");u=m[t];if(u){if((''+u).indexOf('function')>=0){if(d&&e)u=m[t](d,e);else if(d)u=m[t](d);else u=m[t]()}}if(u)r=1;u=m[t+1];if(u&&!m[f]){if((''+u).indexOf('function')>=0){if(d&&e)u=m[t+1](d,e);else i"
+"f(d)u=m[t+1](d);else u=m[t+1]()}}m[f]=1;if(u)r=1}}return r};s.m_ll=function(){var s=this,g=s.m_dl,i,o;if(g)for(i=0;i<g.length;i++){o=g[i];if(o)s.loadModule(o.n,o.u,o.d,o.l,o.e,1);g[i]=0}};s.loadMod"
+"ule=function(n,u,d,l,e,ln){var s=this,m=0,i,g,o=0,f1,f2,c=s.h?s.h:s.b,b,tcf;if(n){i=n.indexOf(':');if(i>=0){g=n.substring(i+1);n=n.substring(0,i)}else g=\"m_\"+n;m=s.m_i(n)}if((l||(n&&!s.m_a(n,g)))"
+"&&u&&s.d&&c&&s.d.createElement){if(d){m._d=1;m._dl=1}if(ln){if(s.ssl)u=s.rep(u,'http:','https:');i='s_s:'+s._in+':'+n+':'+g;b='var s=s_c_il['+s._in+'],o=s.d.getElementById(\"'+i+'\");if(s&&o){if(!o"
+".l&&s.wd.'+g+'){o.l=1;if(o.i)clearTimeout(o.i);o.i=0;s.m_a(\"'+n+'\",\"'+g+'\"'+(e?',\"'+e+'\"':'')+')}';f2=b+'o.c++;if(!s.maxDelay)s.maxDelay=250;if(!o.l&&o.c<(s.maxDelay*2)/100)o.i=setTimeout(o.f"
+"2,100)}';f1=new Function('e',b+'}');tcf=new Function('s','c','i','u','f1','f2','var e,o=0;try{o=s.d.createElement(\"script\");if(o){o.type=\"text/javascript\";'+(n?'o.id=i;o.defer=true;o.onload=o.o"
+"nreadystatechange=f1;o.f2=f2;o.l=0;':'')+'o.src=u;c.appendChild(o);'+(n?'o.c=0;o.i=setTimeout(f2,100)':'')+'}}catch(e){o=0}return o');o=tcf(s,c,i,u,f1,f2)}else{o=new Object;o.n=n+':'+g;o.u=u;o.d=d;"
+"o.l=l;o.e=e;g=s.m_dl;if(!g)g=s.m_dl=new Array;i=0;while(i<g.length&&g[i])i++;g[i]=o}}else if(n){m=s.m_i(n);m._e=1}return m};s.voa=function(vo,r){var s=this,l=s.va_g,i,k,v,x;for(i=0;i<l.length;i++){"
+"k=l[i];v=vo[k];if(v||vo['!'+k]){if(!r&&(k==\"contextData\"||k==\"retrieveLightData\")&&s[k])for(x in s[k])if(!v[x])v[x]=s[k][x];s[k]=v}}};s.vob=function(vo){var s=this,l=s.va_g,i,k;for(i=0;i<l.leng"
+"th;i++){k=l[i];vo[k]=s[k];if(!vo[k])vo['!'+k]=1}};s.dlt=new Function('var s=s_c_il['+s._in+'],d=new Date,i,vo,f=0;if(s.dll)for(i=0;i<s.dll.length;i++){vo=s.dll[i];if(vo){if(!s.m_m(\"d\")||d.getTime"
+"()-vo._t>=s.maxDelay){s.dll[i]=0;s.t(vo)}else f=1}}if(s.dli)clearTimeout(s.dli);s.dli=0;if(f){if(!s.dli)s.dli=setTimeout(s.dlt,s.maxDelay)}else s.dll=0');s.dl=function(vo){var s=this,d=new Date;if("
+"!vo)vo=new Object;s.vob(vo);vo._t=d.getTime();if(!s.dll)s.dll=new Array;s.dll[s.dll.length]=vo;if(!s.maxDelay)s.maxDelay=250;s.dlt()};s.track=s.t=function(vo){var s=this,trk=1,tm=new Date,sed=Math&"
+"&Math.random?Math.floor(Math.random()*10000000000000):tm.getTime(),sess='s'+Math.floor(tm.getTime()/10800000)%10+sed,y=tm.getYear(),vt=tm.getDate()+'/'+tm.getMonth()+'/'+(y<1900?y+1900:y)+' '+tm.ge"
+"tHours()+':'+tm.getMinutes()+':'+tm.getSeconds()+' '+tm.getDay()+' '+tm.getTimezoneOffset(),tcf,tfs=s.gtfs(),ta=-1,q='',qs='',code='',vb=new Object;s.gl(s.vl_g);s.uns();s.m_ll();if(!s.td){var tl=tf"
+"s.location,a,o,i,x='',c='',v='',p='',bw='',bh='',j='1.0',k=s.c_w('s_cc','true',0)?'Y':'N',hp='',ct='',pn=0,ps;if(String&&String.prototype){j='1.1';if(j.match){j='1.2';if(tm.setUTCDate){j='1.3';if(s"
+".isie&&s.ismac&&s.apv>=5)j='1.4';if(pn.toPrecision){j='1.5';a=new Array;if(a.forEach){j='1.6';i=0;o=new Object;tcf=new Function('o','var e,i=0;try{i=new Iterator(o)}catch(e){}return i');i=tcf(o);if"
+"(i&&i.next)j='1.7'}}}}}if(s.apv>=4)x=screen.width+'x'+screen.height;if(s.isns||s.isopera){if(s.apv>=3){v=s.n.javaEnabled()?'Y':'N';if(s.apv>=4){c=screen.pixelDepth;bw=s.wd.innerWidth;bh=s.wd.innerH"
+"eight}}s.pl=s.n.plugins}else if(s.isie){if(s.apv>=4){v=s.n.javaEnabled()?'Y':'N';c=screen.colorDepth;if(s.apv>=5){bw=s.d.documentElement.offsetWidth;bh=s.d.documentElement.offsetHeight;if(!s.ismac&"
+"&s.b){tcf=new Function('s','tl','var e,hp=0;try{s.b.addBehavior(\"#default#homePage\");hp=s.b.isHomePage(tl)?\"Y\":\"N\"}catch(e){}return hp');hp=tcf(s,tl);tcf=new Function('s','var e,ct=0;try{s.b."
+"addBehavior(\"#default#clientCaps\");ct=s.b.connectionType}catch(e){}return ct');ct=tcf(s)}}}else r=''}if(s.pl)while(pn<s.pl.length&&pn<30){ps=s.fl(s.pl[pn].name,100)+';';if(p.indexOf(ps)<0)p+=ps;p"
+"n++}s.resolution=x;s.colorDepth=c;s.javascriptVersion=j;s.javaEnabled=v;s.cookiesEnabled=k;s.browserWidth=bw;s.browserHeight=bh;s.connectionType=ct;s.homepage=hp;s.plugins=p;s.td=1}if(vo){s.vob(vb)"
+";s.voa(vo)}if((vo&&vo._t)||!s.m_m('d')){if(s.usePlugins)s.doPlugins(s);var l=s.wd.location,r=tfs.document.referrer;if(!s.pageURL)s.pageURL=l.href?l.href:l;if(!s.referrer&&!s._1_referrer){s.referrer"
+"=r;s._1_referrer=1}s.m_m('g');if(s.lnk||s.eo){var o=s.eo?s.eo:s.lnk;if(!o)return '';var p=s.pageName,w=1,t=s.ot(o),n=s.oid(o),x=o.s_oidt,h,l,i,oc;if(s.eo&&o==s.eo){while(o&&!n&&t!='BODY'){o=o.paren"
+"tElement?o.parentElement:o.parentNode;if(!o)return '';t=s.ot(o);n=s.oid(o);x=o.s_oidt}oc=o.onclick?''+o.onclick:'';if((oc.indexOf(\"s_gs(\")>=0&&oc.indexOf(\".s_oc(\")<0)||oc.indexOf(\".tl(\")>=0)r"
+"eturn ''}if(n)ta=o.target;h=s.oh(o);i=h.indexOf('?');h=s.linkLeaveQueryString||i<0?h:h.substring(0,i);l=s.linkName;t=s.linkType?s.linkType.toLowerCase():s.lt(h);if(t&&(h||l))q+='&pe=lnk_'+(t=='d'||"
+"t=='e'?s.ape(t):'o')+(h?'&pev1='+s.ape(h):'')+(l?'&pev2='+s.ape(l):'');else trk=0;if(s.trackInlineStats){if(!p){p=s.pageURL;w=0}t=s.ot(o);i=o.sourceIndex;if(s.gg('objectID')){n=s.gg('objectID');x=1"
+";i=1}if(p&&n&&t)qs='&pid='+s.ape(s.fl(p,255))+(w?'&pidt='+w:'')+'&oid='+s.ape(s.fl(n,100))+(x?'&oidt='+x:'')+'&ot='+s.ape(t)+(i?'&oi='+i:'')}}if(!trk&&!qs)return '';s.sampled=s.vs(sed);if(trk){if(s"
+".sampled)code=s.mr(sess,(vt?'&t='+s.ape(vt):'')+s.hav()+q+(qs?qs:s.rq()),0,ta);qs='';s.m_m('t');if(s.p_r)s.p_r();s.referrer=s.lightProfileID=s.retrieveLightProfiles=s.deleteLightProfiles=''}s.sq(qs"
+");}else{s.dl(vo);}if(vo)s.voa(vb,1);s.lnk=s.eo=s.linkName=s.linkType=s.wd.s_objectID=s.ppu=s.pe=s.pev1=s.pev2=s.pev3='';if(s.pg)s.wd.s_lnk=s.wd.s_eo=s.wd.s_linkName=s.wd.s_linkType='';return code};"
+"s.trackLink=s.tl=function(o,t,n,vo){var s=this;s.lnk=s.co(o);s.linkType=t;s.linkName=n;s.t(vo)};s.trackLight=function(p,ss,i,vo){var s=this;s.lightProfileID=p;s.lightStoreForSeconds=ss;s.lightIncre"
+"mentBy=i;s.t(vo)};s.jsLoaded=function(){var s=this,x;if(s.lmq)for(i=0;i<s.lmq.length;i++){x=s.lmq[i];s.loadModule(x.n,x.u,x.d)}if(s.onLoad)s.onLoad(s);if(s.tq)for(i=0;i<s.tq.length;i++)s.t(s.tq[i])"
+"};s.wd=window;s.ssl=(s.wd.location.protocol.toLowerCase().indexOf('https')>=0);s.d=document;s.b=s.d.body;if(s.d.getElementsByTagName){s.h=s.d.getElementsByTagName('HEAD');if(s.h)s.h=s.h[0]}s.n=navi"
+"gator;s.u=s.n.userAgent;s.ns6=s.u.indexOf('Netscape6/');var apn=s.n.appName,v=s.n.appVersion,ie=v.indexOf('MSIE '),o=s.u.indexOf('Opera '),i;if(v.indexOf('Opera')>=0||o>0)apn='Opera';s.isie=(apn=='"
+"Microsoft Internet Explorer');s.isns=(apn=='Netscape');s.isopera=(apn=='Opera');s.ismac=(s.u.indexOf('Mac')>=0);if(o>0)s.apv=parseFloat(s.u.substring(o+6));else if(ie>0){s.apv=parseInt(i=v.substrin"
+"g(ie+5));if(s.apv>3)s.apv=parseFloat(i)}else if(s.ns6>0)s.apv=parseFloat(s.u.substring(s.ns6+10));else s.apv=parseFloat(v);s.em=0;if(s.em.toPrecision)s.em=3;else if(String.fromCharCode){i=escape(St"
+"ring.fromCharCode(256)).toUpperCase();s.em=(i=='%C4%80'?2:(i=='%U0100'?1:0))}if(s.oun)s.sa(s.oun);s.sa(un);s.vl_l='dynamicVariablePrefix,visitorID,vmk,visitorMigrationKey,visitorMigrationServer,vis"
+"itorMigrationServerSecure,ppu,charSet,visitorNamespace,cookieDomainPeriods,cookieLifetime,pageName,pageURL,referrer,currencyCode';s.va_l=s.sp(s.vl_l,',');s.vl_mr=s.vl_m='charSet,visitorNamespace,co"
+"okieDomainPeriods,cookieLifetime,contextData,lightProfileID,lightStoreForSeconds,lightIncrementBy';s.vl_t=s.vl_l+',variableProvider,channel,server,pageType,transactionID,purchaseID,campaign,state,z"
+"ip,events,events2,products,linkName,linkType,contextData,lightProfileID,lightStoreForSeconds,lightIncrementBy,retrieveLightProfiles,deleteLightProfiles,retrieveLightData';var n;for(n=1;n<=75;n++){s"
+".vl_t+=',prop'+n+',eVar'+n;s.vl_m+=',prop'+n+',eVar'+n}for(n=1;n<=5;n++)s.vl_t+=',hier'+n;for(n=1;n<=3;n++)s.vl_t+=',list'+n;s.va_m=s.sp(s.vl_m,',');s.vl_l2=',tnt,pe,pev1,pev2,pev3,resolution,color"
+"Depth,javascriptVersion,javaEnabled,cookiesEnabled,browserWidth,browserHeight,connectionType,homepage,plugins';s.vl_t+=s.vl_l2;s.va_t=s.sp(s.vl_t,',');s.vl_g=s.vl_t+',trackingServer,trackingServerS"
+"ecure,trackingServerBase,fpCookieDomainPeriods,disableBufferedRequests,mobile,visitorSampling,visitorSamplingGroup,dynamicAccountSelection,dynamicAccountList,dynamicAccountMatch,trackDownloadLinks,"
+"trackExternalLinks,trackInlineStats,linkLeaveQueryString,linkDownloadFileTypes,linkExternalFilters,linkInternalFilters,linkTrackVars,linkTrackEvents,linkNames,lnk,eo,lightTrackVars,_1_referrer,un';"
+"s.va_g=s.sp(s.vl_g,',');s.pg=pg;s.gl(s.vl_g);s.contextData=new Object;s.retrieveLightData=new Object;if(!ss)s.wds();if(pg){s.wd.s_co=function(o){s_gi(\"_\",1,1).co(o)};s.wd.s_gs=function(un){s_gi(u"
+"n,1,1).t()};s.wd.s_dc=function(un){s_gi(un,1).t()}}",w=window,l=w.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf('MSIE '),m=u.indexOf('Netscape6/'),a,i,x,s;if(un){un=un.toLowerCase();if(l)for(i=0;i<l.length;i++){s=l[i];x=s._c;if((!x||x=='s_c'||x=='s_l')&&(s.oun==un||(s.fs&&s.sa&&s.fs(s.oun,un)))){if(s.sa)s.sa(un);if(x=='s_c')return s}else s=0}}w.s_an='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';w.s_sp=new Function("x","d","var a=new Array,i=0,j;if(x){if(x.split)a=x.split(d);else if(!d)for(i=0;i<x.length;i++)a[a.length]=x.substring(i,i+1);else while(i>=0){j=x.indexOf(d,i);a[a.length]=x.subst"
+"ring(i,j<0?x.length:j);i=j;if(i>=0)i+=d.length}}return a");w.s_jn=new Function("a","d","var x='',i,j=a.length;if(a&&j>0){x=a[0];if(j>1){if(a.join)x=a.join(d);else for(i=1;i<j;i++)x+=d+a[i]}}return x");w.s_rep=new Function("x","o","n","return s_jn(s_sp(x,o),n)");w.s_d=new Function("x","var t='`^@$#',l=s_an,l2=new Object,x2,d,b=0,k,i=x.lastIndexOf('~~'),j,v,w;if(i>0){d=x.substring(0,i);x=x.substring(i+2);l=s_sp(l,'');for(i=0;i<62;i++)l2[l[i]]=i;t=s_sp(t,'');d"
+"=s_sp(d,'~');i=0;while(i<5){v=0;if(x.indexOf(t[i])>=0) {x2=s_sp(x,t[i]);for(j=1;j<x2.length;j++){k=x2[j].substring(0,1);w=t[i]+k;if(k!=' '){v=1;w=d[b+l2[k]]}x2[j]=w+x2[j].substring(1)}}if(v)x=s_jn("
+"x2,'');else{w=t[i]+' ';if(x.indexOf(w)>=0)x=s_rep(x,w,t[i]);i++;b+=62}}}return x");w.s_fe=new Function("c","return s_rep(s_rep(s_rep(c,'\\\\','\\\\\\\\'),'\"','\\\\\"'),\"\\n\",\"\\\\n\")");w.s_fa=new Function("f","var s=f.indexOf('(')+1,e=f.indexOf(')'),a='',c;while(s>=0&&s<e){c=f.substring(s,s+1);if(c==',')a+='\",\"';else if((\"\\n\\r\\t \").indexOf(c)<0)a+=c;s++}return a?'\"'+a+'\"':"
+"a");w.s_ft=new Function("c","c+='';var s,e,o,a,d,q,f,h,x;s=c.indexOf('=function(');while(s>=0){s++;d=1;q='';x=0;f=c.substring(s);a=s_fa(f);e=o=c.indexOf('{',s);e++;while(d>0){h=c.substring(e,e+1);if(q){i"
+"f(h==q&&!x)q='';if(h=='\\\\')x=x?0:1;else x=0}else{if(h=='\"'||h==\"'\")q=h;if(h=='{')d++;if(h=='}')d--}if(d>0)e++}c=c.substring(0,s)+'new Function('+(a?a+',':'')+'\"'+s_fe(c.substring(o+1,e))+'\")"
+"'+c.substring(e+1);s=c.indexOf('=function(')}return c;");c=s_d(c);if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a<5||v.indexOf('Opera')>=0||u.indexOf('Opera')>=0)c=s_ft(c);if(!s){s=new Object;if(!w.s_c_in){w.s_c_il=new Array;w.s_c_in=0}s._il=w.s_c_il;s._in=w.s_c_in;s._il[s._in]=s;w.s_c_in++;}s._c='s_c';(new Function("s","un","pg","ss",c))(s,un,pg,ss);return s}
ct1.all_pages=function(){var that={};that.write=function(){var webAnalytics=new ct1.WebAnalyticsService();var pageTrackingVars={};$(".setPageTracking").each(function(){pageTrackingVars[$(this).attr("id")]=$(this).attr("title");});$("#lightbox .setPageTrackingLightBox").each(function(){pageTrackingVars[$(this).attr("id")]=$(this).attr("title");});webAnalytics.trackPage(pageTrackingVars);};return that;};ct1.all_pages.trackPage=function(){ct1.all_pages().write();};